dcodegroup/laravel-myob-employee

This package provides base functionality for linking a user with MYOB

0.1.2 2022-11-15 03:35 UTC

This package is auto-updated.

Last update: 2024-04-15 06:25:46 UTC


README

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

Installation

You can install the package via composer:

composer require dcodegroup/laravel-myob-employee

Then run the install command.

php artsian laravel-myob-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.

  • myob_employee_id
  • myob_employee_payroll_details_id
  • myob_employee_payment_details_id
  • myob_employee_standard_pay_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 = [
                   'myob_employee_id',
                   'myob_employee_payroll_details_id',
                   'myob_employee_payment_details_id',
                   'myob_employee_standard_pay_id',
                   ...
    ];

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

use Dcodegroup\LaravelMyobEmployee\Contracts\MyobEmployeeUserMappings;

class User extends Authenticatable implements MyobEmployeeUserMappings
{
    ...

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

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

You should add the following trait to the Users model.

class User extends Authenticatable
{
    use UsesMyobEmployee;

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

[example.com/myob-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.