File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 22
33namespace Maklad \Permission ;
44
5+ use Illuminate \Contracts \Auth \Access \Gate ;
56use Illuminate \Support \ServiceProvider ;
67use Illuminate \View \Compilers \BladeCompiler ;
78use Maklad \Permission \Contracts \PermissionInterface as Permission ;
1415 */
1516class PermissionServiceProvider extends ServiceProvider
1617{
17- public function boot (PermissionRegistrar $ permissionLoader )
18+ public function boot ()
1819 {
1920 $ helpers = new Helpers ();
2021 if ($ helpers ->isNotLumen ()) {
@@ -40,7 +41,9 @@ public function boot(PermissionRegistrar $permissionLoader)
4041
4142 $ this ->registerModelBindings ();
4243
43- $ permissionLoader ->registerPermissions ();
44+ $ this ->app ->afterResolving (Gate::class, function () {
45+ app (PermissionRegistrar::class)->registerPermissions ();
46+ });
4447 }
4548
4649 public function register ()
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ public function hasAnyPermission(...$permissions): bool
281281 * @return bool
282282 * @throws \ReflectionException
283283 */
284- public function hasAllPermissions (... $ permissions ): bool
284+ public function hasAllPermissions (...$ permissions ): bool
285285 {
286286 $ helpers = new Helpers ();
287287 $ permissions = $ helpers ->flattenArray ($ permissions );
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ public function hasAnyRole($roles): bool
168168 *
169169 * @return bool
170170 */
171- public function hasAllRoles (... $ roles ): bool
171+ public function hasAllRoles (...$ roles ): bool
172172 {
173173 $ helpers = new Helpers ();
174174 $ roles = $ helpers ->flattenArray ($ roles );
You can’t perform that action at this time.
0 commit comments