File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,20 @@ public function edit($name) : View
44
44
{
45
45
$ role = (new Role )->with ('permissions ' )->find ($ name );
46
46
$ this ->authorize ('edit ' , $ role );
47
- $ entities = (new Entity )->whereNotIn ('name ' , ['permission ' , 'entity ' ])->get ();
48
47
$ actions = (new Action )->all ();
48
+ $ 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
+ ->map (function ($ entity ) {
56
+ return (new Entity )
57
+ ->firstOrCreate ([
58
+ 'name ' => $ entity ,
59
+ ]);
60
+ });
49
61
$ ownerships = (new Ownership )->all ();
50
62
$ permissionMatrix = [];
51
63
You can’t perform that action at this time.
0 commit comments