@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('permission_user', function (Blueprint $table) { |
|
| 16 | + Schema::create('permission_user', function(Blueprint $table) { |
|
| 17 | 17 | $table->id(); |
| 18 | 18 | $table->foreignId('permission_id')->constrained()->cascadeOnDelete(); |
| 19 | 19 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('roles', function (Blueprint $table) { |
|
| 15 | + Schema::create('roles', function(Blueprint $table) { |
|
| 16 | 16 | $table->id(); |
| 17 | 17 | $table->string('name'); |
| 18 | 18 | $table->string('slug')->unique(); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('role_user', function (Blueprint $table) { |
|
| 15 | + Schema::create('role_user', function(Blueprint $table) { |
|
| 16 | 16 | $table->id('id'); |
| 17 | 17 | $table->foreignId('role_id')->constrained()->cascadeOnDelete(); |
| 18 | 18 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('permission_role', function (Blueprint $table) { |
|
| 15 | + Schema::create('permission_role', function(Blueprint $table) { |
|
| 16 | 16 | $table->id(); |
| 17 | 17 | $table->foreignId('permission_id')->constrained()->cascadeOnDelete(); |
| 18 | 18 | $table->foreignId('role_id')->constrained()->cascadeOnDelete(); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('permissions', function (Blueprint $table) { |
|
| 15 | + Schema::create('permissions', function(Blueprint $table) { |
|
| 16 | 16 | $table->id(); |
| 17 | 17 | $table->string('name', 50); |
| 18 | 18 | $table->string('slug')->unique(); |
@@ -24,10 +24,10 @@ |
||
| 24 | 24 | protected $table = 'permissions'; |
| 25 | 25 | |
| 26 | 26 | /** @var array */ |
| 27 | - protected $fillable = ['name', 'slug', 'resource', 'system']; |
|
| 27 | + protected $fillable = [ 'name', 'slug', 'resource', 'system' ]; |
|
| 28 | 28 | |
| 29 | 29 | /** @var array */ |
| 30 | - protected $casts = ['system' => 'bool']; |
|
| 30 | + protected $casts = [ 'system' => 'bool' ]; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Find a permission by slug. |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | protected $table = 'roles'; |
| 22 | 22 | |
| 23 | 23 | /** @var array */ |
| 24 | - protected $fillable = ['name', 'slug', 'description', 'system']; |
|
| 24 | + protected $fillable = [ 'name', 'slug', 'description', 'system' ]; |
|
| 25 | 25 | |
| 26 | 26 | /** @var array */ |
| 27 | 27 | protected $casts = [ |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $path = __DIR__.'/../config/acl.php'; |
| 32 | 32 | |
| 33 | - $this->publishes([$path => config_path('acl.php')], 'laravel-acl'); |
|
| 33 | + $this->publishes([ $path => config_path('acl.php') ], 'laravel-acl'); |
|
| 34 | 34 | |
| 35 | 35 | $this->mergeConfigFrom($path, 'acl'); |
| 36 | 36 | } |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | protected function registerBladeDirectives() |
| 53 | 53 | { |
| 54 | 54 | /** @var BladeCompiler $blade */ |
| 55 | - $blade = $this->app['blade.compiler']; |
|
| 56 | - $blade->directive('canAtLeast', function ($expression) { |
|
| 55 | + $blade = $this->app[ 'blade.compiler' ]; |
|
| 56 | + $blade->directive('canAtLeast', function($expression) { |
|
| 57 | 57 | return "<?php if (app('laravel-acl.directives.canAtLeast')->handle({$expression})): ?>"; |
| 58 | 58 | }); |
| 59 | - $blade->directive('endCanAtLeast', function ($expression) { |
|
| 59 | + $blade->directive('endCanAtLeast', function($expression) { |
|
| 60 | 60 | return '<?php endif; ?>'; |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | - $blade->directive('role', function ($expression) { |
|
| 63 | + $blade->directive('role', function($expression) { |
|
| 64 | 64 | return "<?php if (app('laravel-acl.directives.role')->handle({$expression})): ?>"; |
| 65 | 65 | }); |
| 66 | - $blade->directive('endRole', function ($expression) { |
|
| 66 | + $blade->directive('endRole', function($expression) { |
|
| 67 | 67 | return '<?php endif; ?>'; |
| 68 | 68 | }); |
| 69 | 69 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param array $options |
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | - public function authorizePermissionResource(string $resource, array $options = []) |
|
| 35 | + public function authorizePermissionResource(string $resource, array $options = [ ]) |
|
| 36 | 36 | { |
| 37 | 37 | $permissions = $this->resourcePermissionMap(); |
| 38 | 38 | $collection = new Collection; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ])); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $collection->groupBy('ability')->each(function ($permission, $ability) use ($resource, $options) { |
|
| 46 | + $collection->groupBy('ability')->each(function($permission, $ability) use ($resource, $options) { |
|
| 47 | 47 | $this->middleware("can:{$resource}.{$ability}") |
| 48 | 48 | ->only($permission->pluck('method')->toArray()); |
| 49 | 49 | }); |