34 lines
685 B
PHP
34 lines
685 B
PHP
|
<?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);
|
||
|
}
|
||
|
}
|