Skip to content

Commit 1803ac8

Browse files
committed
Added functions to fetch single permission
and role
1 parent 4b9f701 commit 1803ac8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Helpers/Helpers.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ function fetchPermissions(int $status = null) : Object
243243
return $permissions;
244244
}
245245

246+
function fetchPermission(int $permission_id) : Object | null
247+
{
248+
$permission = \Obrainwave\AccessTree\Models\Permission::find($permission_id);
249+
250+
return $permission;
251+
}
252+
246253
function fetchRoles(int $status = null) : Object
247254
{
248255
if($status == null)
@@ -255,6 +262,13 @@ function fetchRoles(int $status = null) : Object
255262
return $roles;
256263
}
257264

265+
function fetchRole(int $role_id) : Object | null
266+
{
267+
$role = \Obrainwave\AccessTree\Models\Role::find($role_id);
268+
269+
return $role;
270+
}
271+
258272
function fetchUserRoles(int $user_id) : Object
259273
{
260274
$user_roles = $roles = \Obrainwave\AccessTree\Models\UserRole::where('user_id', $user_id)->get();

0 commit comments

Comments
 (0)