定制 dcodegroup/laravel-xero-employee 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dcodegroup/laravel-xero-employee

最新稳定版本:0.1.12

Composer 安装命令:

composer require dcodegroup/laravel-xero-employee

包简介

This package provides base functionality for linking a user with Xero

README 文档

README

This package provides the standard xero functionality for syncing Xero Employee ID with users and assigning pay rates to users.

Installation

You can install the package via composer:

composer require dcodegroup/laravel-xero-employee

Then run the install command.

php artsian laravel-xero-employee:install

This will publish the configuration and migrations file

Run the migrations

php artsian migrate

Configuration

After running install the following fields will be added to the users table.

  • xero_employee_id
  • xero_default_earnings_rate_id
  • xero_time_and_a_half_earnings_rate_id
  • xero_double_time_earnings_rate_id

You will need to add these fields to your fillable array within the User::class model

    /**
     * The attributes that are mass assignable.
     *
     * @var string[]
     */
    protected $fillable = [
                   'xero_employee_id',
                   'xero_default_payroll_calendar_id',
                   'xero_default_earnings_rate_id',
                   'xero_time_and_a_half_earnings_rate_id',
                   'xero_double_time_earnings_rate_id',
                   ...
    ];

You also need to add the following interface to the User::class model.

use Dcodegroup\LaravelXeroEmployee\Contracts\XeroEmployeeUserMappings;

class User extends Authenticatable implements XeroEmployeeUserMappings
{
    ...

You should then implement the methods defined in the contract. eg Like below but what ever your using

  public function getXeroEmployeeNameAttribute(): string
  {
    //return $this->name;
    //return $this->first_name . ' ' . $this->last_name;
    return $this->prefered_name;
  }

The assumption is you have already synced the payroll details from the dcodegroup/laravel-xero-payroll-au.

There is a second command you can use to automatically populate the fields added for earnings rate to default to those you have already configured within dcodegroup/laravel-xero-payroll-au. You can run this multiple times as you get new users as it will only update users that have no values.

You should add the following trait to the Users model.

class User extends Authenticatable
{
    use UsesXeroEmployee;

This package provides a route that can be used to provide an endpoint to dispatch the SyncXeroEmployee job.

[example.com/xero-employee/{user}] xero_employee.sync Please see the config file if you wish to customise the route. This will dispatch the job for the user and sync them to your application.

统计信息

  • 总下载量: 2.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-30