We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75c52bb commit fa95b1eCopy full SHA for fa95b1e
src/Http/Controllers/RolesController.php
@@ -44,8 +44,20 @@ public function edit($name) : View
44
{
45
$role = (new Role)->with('permissions')->find($name);
46
$this->authorize('edit', $role);
47
- $entities = (new Entity)->whereNotIn('name', ['permission', 'entity'])->get();
48
$actions = (new Action)->all();
+ $entities = collect(array_keys(app('Illuminate\Contracts\Auth\Access\Gate')->policies()))
49
+ ->map(function ($entity) {
50
+ return strtolower(collect(explode('\\', $entity))->last());
51
+ })
52
+ ->filter(function ($entity) {
53
+ return ! in_array($entity, ['permission', 'entity']);
54
55
56
+ return (new Entity)
57
+ ->firstOrCreate([
58
+ 'name' => $entity,
59
+ ]);
60
+ });
61
$ownerships = (new Ownership)->all();
62
$permissionMatrix = [];
63
0 commit comments