Employee
This module adds the following resources:
- Employee
- EmployeeSchedule
This module comes with a lot of configurations. Make sure you edit these if needed.
Installation
To install this module:
This module depends on qore/addresses
. Make sure you install, publish and migrate these modules as well.
composer require qore/employee
php artisan vendor:publish --tag=qore.employee.config
php artisan vendor:publish --tag=qore.employee.db
php artisan vendor:publish --tag=qore.employee.frontend
To upgrade this module:
composer update qore/employee
If you need to upgrade migrations or Vue components:
php artisan vendor:publish --tag=qore.employee.db --force
php artisan vendor:publish --tag=qore.employee.frontend --force
Getting started
-
Make sure to publish and migrate the migrations in
qore/employee
andqore/address
. -
Make sure your Skeleton is up to date with the following:
Employee Feature Merge Request -
Modify your
User
model:
class User extends QoreUser
{
use UserHasEmployee;
- Add the following traits to the UserResource.
class UserResource extends QoreResource
{
use \Qore\Employee\Traits\UserResource\UserEmployeeResourceFields;
use \Qore\Employee\Traits\UserResource\CustomFillsUserEmployee;
Configuration
The resources will be registered by default, however you can extend every resource, model etc. by registering your own resource.
In the employee.php
config file you can register your own custom seeders.
Helper classes and functions
Helper functions
function | description |
---|---|
employees_resource | Returns the class-string of the employee resource set in the configuration file. |
employees_resource_instance | Returns a class instance returned by the employee_resource function. |
employees_model | Returns the model registered in the model function of the employee resource. |
is_current_user_employee_in_current_tenant | Returns true if the current authenticated user is an employee in the current tenant. |
is_user_employee_in_current_tenant | Returns true if the given user is an employee in the current tenant. |
retrieve_employee_model | Returns an employee model instance for the given id. Does not use cache. |
Services
EmployeeScheduleService
The EmployeeScheduleServiceContract
is bound to the EmployeeScheduleService
.
This binding could be overridden by binding the instance in your own AppServiceProvider
.
Method | Description |
---|---|
getCurrentScheduleForEmployee | Returns the current schedule for the given employee. |
getActiveScheduleForEmployeeAt | Returns the active schedule for the given employee at the given date. |
getWorkingHoursForEmployeeForDate | Returns a float value stating the work hours for an employee on the given date. |
getWorkingHoursForEmployeeBetween | Returns a float value stating the work hours for an employee between two dates. |
getSchedulesForEmployeeBetween | Returns a collection of EmployeeSchedules for an employee between two dates. |
getWorkingHoursForEmployeeForWeek | Returns a float value stating the work hours for an employee in the week of the given date. |
getWorkingHoursForEmployeeForCurrentWeek | Returns a float value stating the work hours for an employee in the current week. |
getWorkingHoursForEmployeeForLastWeek | Returns a float value stating the work hours for an employee in the previous week. |
getWorkingHoursForEmployeeForWeekNumber | Returns a float value stating the work hours for an employee in the given week and year. |
getPreviousWorkWeekDay | Returns a Carbon date instance for the previous working day (For example friday when calling this function on a sat/sun/monday |
getPreviousWorkingDayForEmployee | Returns a Carbon date instance for the previous working day for an employee |
Release notes
All notable changes will be documented here.