<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class ErrorLog extends Model
{
    protected $table = 'error_logs';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'request_url',
        'request_method',
        'status_code',
        'description',
        'user_agent',
        'referrer',
        'ip',
        'user_id'
    ];
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class ClaimFormData extends Model
{
    protected $table = 'claim_form_data';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'claim_form_id',
        'expense_type_id',
        'name',
        'price',
        'currency_id',
        'qty',
        'image',
        'bill_date'
    ];
    
    public function claimForm()
    {
        return $this->belongsTo('App\Model\ClaimForm');
    }
    
    public function expenseType ()
    {
        return $this->belongsTo('App\Model\ExpenseType');
    }
    
    public function currency()
    {
        return $this->belongsTo('App\Model\Currency');
    }
    
}
<file_sep>FROM php:7.3.10-fpm-alpine

# Fix: iconv(): Wrong charset, conversion from UTF-8 to UTF-8//IGNORE is not allowed in Command line code on line 1
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv

# Install php extensions
RUN apk update \
    && apk add --no-cache libzip-dev libmcrypt libmcrypt-dev zlib-dev \
    && docker-php-ext-install exif zip bcmath mysqli pdo pdo_mysql ctype json

# Install GD extensions
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev && \
    docker-php-ext-configure gd \
    --with-gd \
    --with-freetype-dir=/usr/include/ \
    --with-png-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/ && \
    NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
    docker-php-ext-install -j${NPROC} gd && \
    apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer

RUN apk --no-cache update \
    && apk --no-cache add make bash g++ zlib-dev libpng-dev \
    && rm -fr /var/cache/apk/*

WORKDIR /application

EXPOSE 9000

# Start services
CMD ["php-fpm"]
<file_sep># SSL guardian

This is a Letsencrypt(Free SSL cert) related code. 

## Get started


### Start with docker reverse proxy
* Start

        docker-compose -f proxy.yml up -d

    Current state on production server:

        `./start_proxy.sh`

* Stop

        docker-compose -f proxy.yml down

### Manual (cron deamon)
If you need acme.sh to schedule and renew certs only

        docker-compose -f acme.yml up -d

Stop acme.sh deamon

        docker-compose -f acme.yml down

### Basic Auth
If you need basic auth to vhost

	htpasswd {vhost} {username}

If htpasswd command not found

	sudo yum install -y httpd-tools

### Issue cert in Manual mode
Update your API key & API Secret in `.env`
1. [Aliyun](https://github.com/Neilpang/acme.sh/tree/master/dnsapi#11-use-aliyun-domain-api-to-automatically-issue-cert)
2. [Cloudflare](https://github.com/Neilpang/acme.sh/tree/master/dnsapi#1-use-cloudflare-domain-api-to-automatically-issue-cert)
<file_sep>const sendGetRequest = (path, data, callback, errorCallback, finallyCallback) => {
  axios.get(process.env.MIX_API_HOST + path, data).then((response) => {
    callback(response);
  }).catch((error) => {
    errorCallback(error);
  }).finally(() => {
    finallyCallback();
  });
};

const sendPostRequest = (path, data, callback, errorCallback, finallyCallback) => {
  axios.post(process.env.MIX_API_HOST + path, data).then((response) => {
    callback(response);
  }).catch((error) => {
    errorCallback(error);
  }).finally(() => {
    finallyCallback();
  });
};

const sendPutRequest = (path, data, callback, errorCallback, finallyCallback) => {
  axios.put(process.env.MIX_API_HOST + path, data).then((response) => {
    callback(response);
  }).catch((error) => {
    errorCallback(error);
  }).finally(() => {
    finallyCallback();
  });
};

const sendDeleteRequest = (path, data, callback, errorCallback, finallyCallback) => {
  axios.delete(process.env.MIX_API_HOST + path, data).then((response) => {
    callback(response);
  }).catch((error) => {
    errorCallback(error);
  }).finally(() => {
    finallyCallback();
  });
};

const sendPatchRequest = (path, data, callback, errorCallback, finallyCallback) => {
  axios.patch(process.env.MIX_API_HOST + path, data).then((response) => {
    callback(response);
  }).catch((error) => {
    errorCallback(error);
  }).finally(() => {
    finallyCallback();
  });
};

const getTokenRequest = (path, data, callback, errorCallback, finallyCallback) => {
  axios.post(process.env.MIX_API_HOST + path, data, {
    'Content-Type': 'application/x-www-form-urlencoded'
  }).then((response) => {
    callback(response);
  }).catch((error) => {
    errorCallback(error);
  }).finally(() => {
    finallyCallback();
  });
};

export { sendGetRequest, sendPostRequest, sendPutRequest, sendDeleteRequest, sendPatchRequest, getTokenRequest };
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Tax extends Model
{
    protected $table = 'taxes';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'payroll_id',
        'paid_tax'
    ];
    
    public function payroll()
    {
        return $this->belongsTo('App\Model\Payroll');
    }
    
}
<file_sep>require('./bootstrap');

$(document).ready(function() {
    $('.nav-item a').click(function(e){
        e.preventDefault();
        let jump = $(this).attr('href');
        let height = $('.header').height();
        let new_position = $(jump).offset().top - height;
        $('html, body').stop().animate({ scrollTop: new_position }, 500);
    });

    $('.banners').slick({
        arrows: false,
        dots: false,
        infinite: true,
        speed: 300,
        slidesToShow: 1,
        adaptiveHeight: true
    });
})
<file_sep>#!/bin/bash

docker run  \
-p 80:80 \
-p 443:443 \
-it -d --restart always \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
-v $(pwd)/proxy/certs:/etc/nginx/certs \
-v $(pwd)/proxy/acme:/acmecerts \
-v $(pwd)/proxy/conf.d:/etc/nginx/conf.d \
--name proxy \
--net=web_proxy \
neilpang/nginx-proxy<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Payroll extends Model
{
    protected $table = 'payrolls';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'pay_date',
        'salary',
        'approved',
        'approved_by'
    ];
    
    public function user()
    {
        return $this->belongsTo('App\Model\User');
    }
    
    public function taxes()
    {
        return $this->hasMany('App\Model\Tax');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class CheckTime extends Model
{
    const CHECK_OUT = 1;
    const CHECK_IN = 2;
    
    protected $table = 'check_time';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'roster_id',
        'check_time',
        'type'
    ];
    
}
<file_sep>import VueRouter from 'vue-router';

import pages from '../pages/index';

let routes = [
    { path: '*', redirect: {name: 'index'} },
    { path: '/', name: 'index', component: pages.index }
];

export const router = new VueRouter({
  mode: 'history',
  routes // short for `routes: routes`
});
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class ClaimForm extends Model
{
    protected $table = 'claim_form';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'claim_form_type_id',
        'approved',
        'approved_by'
    ];
    
    public function user()
    {
        return $this->belongsTo('App\Model\User');
    }
    
    public function claimFormType()
    {
        return $this->belongsTo('App\Model\ClaimFormType');
    }
    
    public function claimFormData()
    {
        return $this->hasMany('App\Model\ClaimFormData');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class AccessLog extends Model
{
    const CREATE = 1;
    const UPDATE = 2;
    const DELETE = 3;
    
    protected $table = 'access_logs';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'page_id',
        'action_type'
    ];
    
}
<file_sep># Cloudflare API
CF_Email=
CF_Key=

# Aliyun Domain API
Ali_Key=
Ali_Secret=<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Page extends Model
{
    protected $table = 'pages';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'parent_id'
    ];
    
    public function parent()
    {
        return $this->belongsTo('App\Model\Page');
    }
    
    public function children()
    {
        return $this->hasMany('App\Model\Page');
    }
    
    public function permissions()
    {
        return $this->belongsToMany('App\Model\Permission', 'page_has_permission');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Roster extends Model
{
    protected $table = 'roster';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'work_place_id',
        'duty_date',
        'attendances',
        'lunch_time'
    ];
    
    public function user()
    {
        return $this->belongsTo('App\Model\User');
    }
    
    public function workPlace()
    {
        return $this->hasOne('App\Model\WorkPlace');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Permission extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name'
    ];
    
    public function users()
    {
        return $this->belongsToMany('App\Model\User', 'user_has_permission');
    }
    
    public function pages()
    {
        return $this->belongsToMany('App\Model\Page', 'page_has_permission');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;
    
    const AQUARIUS    = 1; // 水瓶座1.21-2.19
    const PISCES      = 2; // 雙魚座 2.20-3.20
    const ARIES       = 3; // 牡羊(白羊)座3.21-4.19
    const TAURUS      = 4; // 金牛座4.20-5.20
    const GEMINI      = 5; // 雙子座5.21-6.21
    const CANCER      = 6; // 巨蟹座6.22-7.22
    const LEO         = 7; // 獅子座7.23-8.22
    const VIRGO       = 8; // 處女座8.23-9.22
    const LIBRA       = 9; // 天秤座9.23-10.23
    const SCORPIO     = 10; // 天蠍座10.24-11.21
    const SAGITTARIUS = 11; // 射手(人馬)座11.22-12.20
    const CAPRICORN   = 12; // 摩羯座12.21-1.20
    
    protected $table = 'users';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'employee_id',
        'password',
        'name',
        'birthday',
        'constellation',
        'salary',
        'enabled',
        'disabled_by'
    ];
    
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];
    
    public function companies()
    {
        return $this->belongsToMany('App\Model\Company', 'company_has_user');
    }
    
    public function permissions()
    {
        return $this->belongsToMany('App\Model\Permission', 'user_has_permission');
    }
    
    public function leaves()
    {
        return $this->hasmany('App\Model\Leave');
    }
    
    public function payrolls()
    {
        return $this->hasMany('App\Model\Payroll');
    }
    
    public function rosters()
    {
        return $this->hasMany('App\Model\Roster');
    }
    
    public function userTransferHistories()
    {
        return $this->hasMany('App\Model\UserTransferHistory');
    }
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Leave extends Model
{
    const NO_PAY_LEAVE = 1;
    const ANNUAL_LEAVE = 2;
    const SICK_LEAVE = 3;
    
    protected $table = 'leaves';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'apply_date',
        'apply_type',
        'approved',
        'approved_by'
    ];
    
    public function user()
    {
        return $this->belongsTo('App\Model\User');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class WorkPlace extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'ibeacon_uuid',
        'major',
        'minor',
        'name'
    ];
    
    public function roster()
    {
        return $this->belongsTo('App\Model\Roster');
    }
    
}
<file_sep><?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Currency extends Model
{
    protected $table = 'currencies';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'rate'
    ];
    
    public function claimFormData()
    {
        return $this->hasMany('App\Model\ClaimFormData');
    }
    
}
<file_sep>import index from './index'

export default { index };
<file_sep>window.Vue = require('vue');

import Vuex from "vuex";

// Import the `getField` getter and the `updateField`
// mutation function from the `vuex-map-fields` module.
import { getField, updateField } from 'vuex-map-fields';

Vue.use(Vuex);

export const store = new Vuex.Store({
  state: {},
  mutations: {
      // Add the `getField` getter to the
      // `getters` of your Vuex store instance.
      getField,
  },
  getters: {
      // Add the `updateField` mutation to the
      // `mutations` of your Vuex store instance.
      updateField,
  }
});
