New-OMIS/app/Service/DepartmentService.php

34 lines
685 B
PHP
Raw Normal View History

2024-04-10 09:30:24 +00:00
<?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);
}
}