employee crud
This commit is contained in:
33
app/Service/DepartmentService.php
Normal file
33
app/Service/DepartmentService.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Department\Repositories;
|
||||
|
||||
use Modules\Department\Models\Department;
|
||||
|
||||
class DepartmentService
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Department::paginate(20);
|
||||
}
|
||||
|
||||
public function getDepartmentById($DepartmentId)
|
||||
{
|
||||
return Department::findOrFail($DepartmentId);
|
||||
}
|
||||
|
||||
public function delete($DepartmentId)
|
||||
{
|
||||
Department::destroy($DepartmentId);
|
||||
}
|
||||
|
||||
public function create($DepartmentDetails)
|
||||
{
|
||||
return Department::create($DepartmentDetails);
|
||||
}
|
||||
|
||||
public function update($DepartmentId, array $newDetails)
|
||||
{
|
||||
return Department::whereId($DepartmentId)->update($newDetails);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user