first commit
This commit is contained in:
39
Modules/Admin/app/Repositories/DepartmentRepository.php
Normal file
39
Modules/Admin/app/Repositories/DepartmentRepository.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Department;
|
||||
|
||||
|
||||
class DepartmentRepository implements DepartmentInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Department::get();
|
||||
}
|
||||
|
||||
public function getDepartmentById($departmentId)
|
||||
{
|
||||
return Department::findOrFail($departmentId);
|
||||
}
|
||||
|
||||
public function delete($departmentId)
|
||||
{
|
||||
Department::destroy($departmentId);
|
||||
}
|
||||
|
||||
public function create(array $departmentDetails)
|
||||
{
|
||||
return Department::create($departmentDetails);
|
||||
}
|
||||
|
||||
public function update($departmentId, array $newDetails)
|
||||
{
|
||||
return Department::where('department_id', $departmentId)->update($newDetails);
|
||||
}
|
||||
|
||||
|
||||
public function pluck(){
|
||||
return Department::pluck('name','department_id');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user