Download the PHP package dcodegroup/laravel-xero-leave without Composer
On this page you can find all versions of the php package dcodegroup/laravel-xero-leave. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-xero-leave
Laravel Xero Leave
This package provides the standard xero functionality for sending leave applications to Xero.
This package provides
- Tables for leave
- depends on dcodegroup/laravel-xero-employee
- events for approval
- config for approval or not
- Configuration for the types of leave
- commands to keep settings updated.
- button to re-sync
How it works
Follow the installation instructions. Select set if you want to approval requests The events that are fired
Events
- Leave application created
- Leave Approval Required
- Leave Approved - has a listener fire send to xero
Installation
You can install the package via composer:
Then run the install command.
This will publish the configuration file and the migrations.
Then run the migrations
The following table will be added to your project
Configuration
Most of configuration has been set the fair defaults. However you can review the configuration file at config/laravel-xero-leave.php
and adjust as needed
Usage
You should implement your own frontend to this package. However the model and the events etc are already fired for you. Below will guide you through what you need to do.
Create your own Leave::class
model class that extends the packages model.
Ensure to add the following trait to the model you will use leave with. eg App\Models\User::class
Example Vue component to update the status of leave that require approval
Routes
Below lists the routes available within this package. It is suggested you check the middleware used and update the configuration accordingly.
xero_leave.update-status
updates the status used for sending to xero when approval is required.
xero_leave.retry-sync
is an endpoint that can be used to retry sending a leave request to xero in case there was an issue.
HTTP Resources
When returning the data for Leave
you most likely are using a resource. There are some elements you should add to your leave resources. See example below.
Events
Communicating with Xero works by firing events. These events have listeners which will fire the listeners and dispatch jobs.
All events accept the Leave::class
as the only parameter.
SendLeaveToXero::class
send the leave record to Xero. This has a listener blah then then dispatches the job SendToXero
LeaveApproved::class
When the leave is changed to approved it will fire this event. This will trigger the sending leave to xero
LeaveDeclined::class
When the leave is changed to un-approved it will fire this event. This will trigger the sending leave to xero (normally an update of the current application)
RequestLeaveApproval::class
If the configuration parameter laravel-xero-leave.applications_require_approval
is true and a new leave request is created then this event will be fired. You can listen to it in your own application fire a notification or email informing who action needs taking.
A request class is already present in this package. You can update and use the code below for your store and update classes in your own controllers.
Jobs
Commands
laravel-xero-leave:install
publishes the configuration file and the migrations
laravel-xero-leave:update-xero-configuration-data
will fetch and store the leave types in the database. You can use `--force
to ensure it runs now.
You should add it to your app/Console/Kernel.php
file to run it once a day. You could run it more often if wanted with the --force flag
Resources
There is no ability to delete a leave application through the Xero API. More information here https://developer.xero.com/documentation/api/payrollau/leaveapplications/#currently-unsupported-features.
All versions of laravel-xero-leave with dependencies
laravel/framework Version ^7.0|^8.0|^9.0|^10.0|^11.0
dcodegroup/laravel-configuration Version ^0.2
dcodegroup/laravel-xero-employee Version ^0.1