New-OMIS/app/Service/DepartmentService.php
2024-04-10 15:15:24 +05:45

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);
}
}