35 lines
681 B
PHP
35 lines
681 B
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Employee\Repositories;
|
||
|
|
||
|
use Modules\Employee\Models\Employee;
|
||
|
|
||
|
class EmployeeRepository implements EmployeeInterface
|
||
|
{
|
||
|
public function findAll()
|
||
|
{
|
||
|
return Employee::get();
|
||
|
}
|
||
|
|
||
|
public function getEmployeeById($employeeId)
|
||
|
{
|
||
|
return Employee::findOrFail($employeeId);
|
||
|
}
|
||
|
|
||
|
public function delete($employeeId)
|
||
|
{
|
||
|
Employee::destroy($employeeId);
|
||
|
}
|
||
|
|
||
|
public function create(array $employeeDetails)
|
||
|
{
|
||
|
return Employee::create($employeeDetails);
|
||
|
}
|
||
|
|
||
|
public function update($employeeId, array $newDetails)
|
||
|
{
|
||
|
return Employee::whereId($employeeId)->update($newDetails);
|
||
|
}
|
||
|
|
||
|
}
|