StocksNew/app/Service/DepartmentService.php

34 lines
685 B
PHP
Raw Normal View History

2024-08-27 12:03:06 +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);
}
}