EmployeeRepository extends Repository
Table of Contents
- RESPONSE_STATUS_ERROR = 'error'
- RESPONSE_STATUS_FAIL = 'fail'
- RESPONSE_STATUS_SUCCESS = 'success'
- $childRelationName : mixed
- $model : mixed
- $parentRepo : mixed
- $repo : mixed
- __construct() : object
- all() : object
- Create a list from employees
- allChild() : string
- cleanNullValues() : null
- Change null values and put string("")
- delete() : string
- Delete employee from the database
- deleteChild() : bool
- deleteDaysoff() : object
- delete a day off for an employee
- ensureHttp400Code() : string
- Return a extension from mimetype
- firstOrCreate() : object
- firstOrNew() : object
- forceDelete() : bool
- getCustomLabelFormat() : array<string|int, mixed>
- Return an array with custom label format
- getEmployeesUserLog() : mixed
- getErrorResponse() : array<string|int, mixed>
- Return all an array of errors like validation in one format
- getFailResponse() : array<string|int, mixed>
- Return all an array of errors like validation in one format
- getModel() : Model
- getObject() : array<string|int, mixed>
- getSuccessResponse() : array<string|int, mixed>
- Return all an array of errors like validation in one format
- getUserStore() : mixed
- listEmployees() : Collection
- Construct a list of employees, the employee list might be filtered by a given service UUID
- mime2ext() : string
- Return a extension from mimetype
- orderQuery() : null
- Destroy record from the database
- paginate() : object
- Create a paginated list from employees
- paginateChild() : array<string|int, mixed>
- setModel() : mixed
- show() : object
- Show the record with the given id
- showChild() : object
- showDaysoff() : object
- show a day off for an employee
- showServices() : object
- Show the services from logged employeee or manager
- store() : object
- Store record from the database
- storeChild() : object
- update() : object
- Update record from the database
- updateChild() : object
Constants
RESPONSE_STATUS_ERROR
public
mixed
RESPONSE_STATUS_ERROR
= 'error'
RESPONSE_STATUS_FAIL
public
mixed
RESPONSE_STATUS_FAIL
= 'fail'
RESPONSE_STATUS_SUCCESS
public
mixed
RESPONSE_STATUS_SUCCESS
= 'success'
Properties
$childRelationName
protected
mixed
$childRelationName
$model
protected
mixed
$model
$parentRepo
protected
mixed
$parentRepo
$repo
protected
mixed
$repo
Methods
__construct()
public
__construct(Employee $model) : object
Parameters
- $model : Employee
-
- A specific model
Return values
object —all()
Create a list from employees
public
all(Request $request) : object
Parameters
- $request : Request
-
- Datas of the object.
Return values
object —allChild()
public
allChild(Request $request, int $parent_id) : string
Parameters
- $request : Request
- $parent_id : int
-
- Id of the parent objects that we want to get.
Tags
Return values
string —cleanNullValues()
Change null values and put string("")
public
cleanNullValues(array<string|int, mixed> &$data[, array<string|int, mixed> $exceptions = [] ]) : null
Parameters
- $data : array<string|int, mixed>
-
- Array with parameters
- $exceptions : array<string|int, mixed> = []
-
- Array with exceptions keys
Return values
null —delete()
Delete employee from the database
public
delete(Request $request, mixed $id) : string
Only store´s manager can delete his employee
Parameters
- $request : Request
-
- Datas of the object that we want to update. *@param $id - Id of the employee that we want to update.
- $id : mixed
-
- Id of the object that we want to remove.
Return values
string —deleteChild()
public
deleteChild(Request $request, mixed $parent_id, int $id) : bool
Parameters
- $request : Request
- $parent_id : mixed
- $id : int
-
- Id of the object that we want to remove.
Tags
Return values
bool —- Success or fail
deleteDaysoff()
delete a day off for an employee
public
deleteDaysoff(Request $request, $parent_id, $id) : object
Parameters
- $request : Request
-
- Datas of the object that we want to delete.
- $parent_id :
-
- Id of the employee we want add a day off.
- $id :
-
- Id of the day off employee we want add a day off.
Return values
object —ensureHttp400Code()
Return a extension from mimetype
public
ensureHttp400Code(mixed $code) : string
Parameters
- $code : mixed
Return values
string —firstOrCreate()
public
firstOrCreate(Request $request) : object
Parameters
- $request : Request
Tags
Return values
object —firstOrNew()
public
firstOrNew(Request $request) : object
Parameters
- $request : Request
Tags
Return values
object —forceDelete()
public
forceDelete(Request $request, int $id) : bool
Parameters
- $request : Request
- $id : int
-
- Id of the object that we want to remove.
Tags
Return values
bool —- Success or fail
getCustomLabelFormat()
Return an array with custom label format
public
getCustomLabelFormat(string $customLabel[, array<string|int, mixed> $data = NULL ]) : array<string|int, mixed>
Parameters
- $customLabel : string
-
- New response label
- $data : array<string|int, mixed> = NULL
-
- Response datas
Return values
array<string|int, mixed> —getEmployeesUserLog()
public
getEmployeesUserLog(Request $request) : mixed
Parameters
- $request : Request
Return values
mixed —getErrorResponse()
Return all an array of errors like validation in one format
public
getErrorResponse(mixed $message[, mixed $code = null ]) : array<string|int, mixed>
Parameters
- $message : mixed
- $code : mixed = null
Return values
array<string|int, mixed> —getFailResponse()
Return all an array of errors like validation in one format
public
getFailResponse(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
- Array with parameters
Return values
array<string|int, mixed> —getModel()
public
getModel() : Model
Tags
Return values
Model —$model - A specific model
getObject()
public
getObject(mixed $id) : array<string|int, mixed>
Parameters
- $id : mixed
Tags
Return values
array<string|int, mixed> —getSuccessResponse()
Return all an array of errors like validation in one format
public
getSuccessResponse([array<string|int, mixed> $data = "" ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed> = ""
-
- Array with parameters
Return values
array<string|int, mixed> —getUserStore()
public
getUserStore() : mixed
Tags
Return values
mixed —listEmployees()
Construct a list of employees, the employee list might be filtered by a given service UUID
public
listEmployees(mixed $store_slug[, string $service_uuid = null ]) : Collection
Parameters
- $store_slug : mixed
- $service_uuid : string = null
-
the service UUID the employees must have assigned
Return values
Collection —mime2ext()
Return a extension from mimetype
public
mime2ext(string $mime) : string
Parameters
- $mime : string
-
- String with mimetype
Return values
string —orderQuery()
Destroy record from the database
public
orderQuery(mixed &$query, array<string|int, mixed> $params) : null
Parameters
- $query : mixed
- $params : array<string|int, mixed>
-
- Array with the pagination params
Return values
null —paginate()
Create a paginated list from employees
public
paginate(Request $request) : object
Parameters
- $request : Request
-
- Datas of the object.
Return values
object —paginateChild()
public
paginateChild(Request $request, mixed $parent_id) : array<string|int, mixed>
Parameters
- $request : Request
- $parent_id : mixed
Tags
Return values
array<string|int, mixed> —setModel()
public
setModel(Model $model) : mixed
Parameters
- $model : Model
-
- A specific model
Tags
Return values
mixed —show()
Show the record with the given id
public
show(Request $request, int $id) : object
The call give the data from one employee The managers only can see their employees
Parameters
- $request : Request
-
- Datas of the object.
- $id : int
-
- Id of the object that we want to show.
Return values
object —showChild()
public
showChild(Request $request, mixed $parent_id, int $id) : object
Parameters
- $request : Request
- $parent_id : mixed
- $id : int
-
- Id of the object that we want to show.
Tags
Return values
object —showDaysoff()
show a day off for an employee
public
showDaysoff(Request $request, $parent_id) : object
Parameters
- $request : Request
-
- Datas of the object that we want to dtore.
- $parent_id :
-
- Id of the employee we want add a day off.
Return values
object —showServices()
Show the services from logged employeee or manager
public
showServices(Request $request) : object
The call give the services from the employee
Parameters
- $request : Request
-
- Datas of the object.
Return values
object —store()
Store record from the database
public
store(Request $request) : object
Parameters
- $request : Request
-
- Datas of the object that we want to update.
Return values
object —storeChild()
public
storeChild(Request $request, mixed $parent_id) : object
Parameters
- $request : Request
- $parent_id : mixed
Tags
Return values
object —update()
Update record from the database
public
update(Request $request, int $id) : object
Only store´s manager can update data from his Employees
Parameters
- $request : Request
-
- Datas of the object that we want to update.
- $id : int
-
- Id of the store that we want to update.
Return values
object —updateChild()
public
updateChild(Request $request, mixed $parent_id, int $id) : object
Parameters
- $request : Request
- $parent_id : mixed
- $id : int
-
- Id of the object that we want to update.