Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #167

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/Traits/HasRoleAndPermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,18 @@ public function rolePermissions()
}

if (config('roles.inheritance')) {
return $permissionModel
::select([$permissionTable . '.*', 'permission_role.created_at as pivot_created_at', 'permission_role.updated_at as pivot_updated_at'])
->join('permission_role', 'permission_role.permission_id', '=', $permissionTable .'.id')
return $permissionModel::select([$permissionTable.'.*', 'permission_role.created_at as pivot_created_at', 'permission_role.updated_at as pivot_updated_at'])
->join('permission_role', 'permission_role.permission_id', '=', $permissionTable.'.id')
->join($roleTable, $roleTable.'.id', '=', 'permission_role.role_id')
->whereIn($roleTable.'.id', $this->getRoles()->pluck('id')->toArray())
->orWhere($roleTable.'.level', '<', $this->level())
->groupBy([$permissionTable . '.id', $permissionTable .'.name', $permissionTable .'.slug', $permissionTable .'.description', $permissionTable .'.model', $permissionTable .'.created_at', 'permissions.updated_at', $permissionTable .'.deleted_at', 'pivot_created_at', 'pivot_updated_at']);
->groupBy([$permissionTable.'.id', $permissionTable.'.name', $permissionTable.'.slug', $permissionTable.'.description', $permissionTable.'.model', $permissionTable.'.created_at', 'permissions.updated_at', $permissionTable.'.deleted_at', 'pivot_created_at', 'pivot_updated_at']);
} else {
return $permissionModel
::select([$permissionTable .'.*', 'permission_role.created_at as pivot_created_at', 'permission_role.updated_at as pivot_updated_at'])
->join('permission_role', 'permission_role.permission_id', '=', $permissionTable .'.id')
return $permissionModel::select([$permissionTable.'.*', 'permission_role.created_at as pivot_created_at', 'permission_role.updated_at as pivot_updated_at'])
->join('permission_role', 'permission_role.permission_id', '=', $permissionTable.'.id')
->join($roleTable, $roleTable.'.id', '=', 'permission_role.role_id')
->whereIn($roleTable.'.id', $this->getRoles()->pluck('id')->toArray())
->groupBy([$permissionTable . '.id', $permissionTable .'.name', $permissionTable .'.slug', $permissionTable .'.description', $permissionTable .'.model', $permissionTable .'.created_at', $permissionTable .'.updated_at', $permissionTable .'.deleted_at', 'pivot_created_at', 'pivot_updated_at']);
->groupBy([$permissionTable.'.id', $permissionTable.'.name', $permissionTable.'.slug', $permissionTable.'.description', $permissionTable.'.model', $permissionTable.'.created_at', $permissionTable.'.updated_at', $permissionTable.'.deleted_at', 'pivot_created_at', 'pivot_updated_at']);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'permissionsTable' => env('ROLES_PERMISSIONS_DATABASE_TABLE', 'permissions'),
'permissionsRoleTable' => env('ROLES_PERMISSION_ROLE_DATABASE_TABLE', 'permission_role'),
'permissionsUserTable' => env('ROLES_PERMISSION_USER_DATABASE_TABLE', 'permission_user'),

/*
|--------------------------------------------------------------------------
| GUI routes custom prefix
Expand Down