New-OMIS/Modules/User/app/Repositories/RoleRepository.php

35 lines
610 B
PHP
Raw Normal View History

2024-04-09 12:15:26 +00:00
<?php
namespace Modules\User\Repositories;
2024-04-11 10:59:09 +00:00
use Spatie\Permission\Models\Role;
2024-04-09 12:15:26 +00:00
class RoleRepository implements RoleInterface
{
public function findAll()
{
return Role::get();
}
public function getRoleById($roleId)
{
return Role::findOrFail($roleId);
}
public function delete($roleId)
{
Role::destroy($roleId);
}
public function create(array $roleDetails)
{
return Role::create($roleDetails);
}
public function update($roleId, array $newDetails)
{
return Role::whereId($roleId)->update($newDetails);
}
}