Skip to main content

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

  1. Make sure to publish and migrate the migrations in qore/employee and qore/address.

  2. Make sure your Skeleton is up to date with the following:
    Employee Feature Merge Request

  3. Modify your User model:

class User extends QoreUser
{
use UserHasEmployee;

  1. 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

functiondescription
employees_resourceReturns the class-string of the employee resource set in the configuration file.
employees_resource_instanceReturns a class instance returned by the employee_resource function.
employees_modelReturns the model registered in the model function of the employee resource.
is_current_user_employee_in_current_tenantReturns true if the current authenticated user is an employee in the current tenant.
is_user_employee_in_current_tenantReturns true if the given user is an employee in the current tenant.
retrieve_employee_modelReturns 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.

MethodDescription
getCurrentScheduleForEmployeeReturns the current schedule for the given employee.
getActiveScheduleForEmployeeAtReturns the active schedule for the given employee at the given date.
getWorkingHoursForEmployeeForDateReturns a float value stating the work hours for an employee on the given date.
getWorkingHoursForEmployeeBetweenReturns a float value stating the work hours for an employee between two dates.
getSchedulesForEmployeeBetweenReturns a collection of EmployeeSchedules for an employee between two dates.
getWorkingHoursForEmployeeForWeekReturns a float value stating the work hours for an employee in the week of the given date.
getWorkingHoursForEmployeeForCurrentWeekReturns a float value stating the work hours for an employee in the current week.
getWorkingHoursForEmployeeForLastWeekReturns a float value stating the work hours for an employee in the previous week.
getWorkingHoursForEmployeeForWeekNumberReturns a float value stating the work hours for an employee in the given week and year.
getPreviousWorkWeekDayReturns a Carbon date instance for the previous working day (For example friday when calling this function on a sat/sun/monday
getPreviousWorkingDayForEmployeeReturns a Carbon date instance for the previous working day for an employee

Release notes

All notable changes will be documented here.