employee crud

This commit is contained in:
2024-04-10 15:15:24 +05:45
parent d92366b1f4
commit b5c603ceec
13 changed files with 420 additions and 194 deletions

View File

@ -6,6 +6,7 @@ interface EmployeeInterface
{
public function findAll();
public function getEmployeeById($employeeId);
public function getEmployeeByEmail($email);
public function delete($employeeId);
public function create($EmployeeDetails);
public function update($employeeId, array $newDetails);

View File

@ -8,7 +8,7 @@ class EmployeeRepository implements EmployeeInterface
{
public function findAll()
{
return Employee::paginate(20);
return Employee::with('user.roles')->paginate(20);
}
public function getEmployeeById($employeeId)
@ -16,6 +16,11 @@ class EmployeeRepository implements EmployeeInterface
return Employee::findOrFail($employeeId);
}
public function getEmployeeByEmail($email)
{
return Employee::where('email', $email)->first();
}
public function delete($employeeId)
{
Employee::destroy($employeeId);