Passed
Push — master ( 522ba7...dac3f8 )
by Andrey
13:44
created
src/Traits/Searchable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
             return $value;
52 52
         }
53 53
 
54
-        return $this->searchOr($model, $value, function () use ($exception, $value) {
54
+        return $this->searchOr($model, $value, function() use ($exception, $value) {
55 55
             throw new $exception($value);
56 56
         });
57 57
     }
Please login to merge, or discard this patch.
src/ServiceProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,57 +46,57 @@
 block discarded – undo
46 46
 
47 47
     protected function blade()
48 48
     {
49
-        if (! Config::useBlade()) {
49
+        if ( ! Config::useBlade()) {
50 50
             return;
51 51
         }
52 52
 
53 53
         /* Role */
54
-        Blade::directive('role', function ($role) {
54
+        Blade::directive('role', function($role) {
55 55
             return "<?php if(\auth()->check() && \auth()->user()->hasRole($role)) { ?>";
56 56
         });
57 57
 
58
-        Blade::directive('endrole', function () {
58
+        Blade::directive('endrole', function() {
59 59
             return '<?php } ?>';
60 60
         });
61 61
 
62 62
         /* Roles */
63
-        Blade::directive('role', function ($roles) {
63
+        Blade::directive('role', function($roles) {
64 64
             return "<?php if(\auth()->check() && \auth()->user()->hasRoles($roles)) { ?>";
65 65
         });
66 66
 
67
-        Blade::directive('endroles', function () {
67
+        Blade::directive('endroles', function() {
68 68
             return '<?php } ?>';
69 69
         });
70 70
 
71 71
         /* Permission */
72
-        Blade::directive('permission', function ($permission) {
72
+        Blade::directive('permission', function($permission) {
73 73
             return "<?php if(\auth()->check() && \auth()->user()->hasPermission($permission)) ?>";
74 74
         });
75 75
 
76
-        Blade::directive('endpermission', function () {
76
+        Blade::directive('endpermission', function() {
77 77
             return '<?php } ?>';
78 78
         });
79 79
 
80 80
         /* Permissions */
81
-        Blade::directive('permissions', function ($permissions) {
81
+        Blade::directive('permissions', function($permissions) {
82 82
             return "<?php if(\auth()->check() && \auth()->user()->hasPermissions($permissions)) ?>";
83 83
         });
84 84
 
85
-        Blade::directive('endpermissions', function () {
85
+        Blade::directive('endpermissions', function() {
86 86
             return '<?php } ?>';
87 87
         });
88 88
     }
89 89
 
90 90
     protected function can()
91 91
     {
92
-        if (! Config::useCanDirective()) {
92
+        if ( ! Config::useCanDirective()) {
93 93
             return;
94 94
         }
95 95
 
96 96
         Permission::query()
97 97
             ->get(['name'])
98
-            ->each(function (Permission $permission) {
99
-                Gate::define($permission->name, function (Authenticatable $user) use ($permission) {
98
+            ->each(function(Permission $permission) {
99
+                Gate::define($permission->name, function(Authenticatable $user) use ($permission) {
100 100
                     return $user->hasPermission($permission);
101 101
                 });
102 102
             });
Please login to merge, or discard this patch.
src/Http/Middleware/Permissions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     protected function has($request, array $permissions): bool
39 39
     {
40 40
         foreach ($permissions as $permission) {
41
-            if (! $request->user()->hasPermission($permission)) {
41
+            if ( ! $request->user()->hasPermission($permission)) {
42 42
                 return false;
43 43
             }
44 44
         }
Please login to merge, or discard this patch.
migrations/2020_06_04_000001_modify_roles_table_add_is_root_column.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@
 block discarded – undo
6 6
 {
7 7
     public function up()
8 8
     {
9
-        $this->table($this->roles, function (Blueprint $table) {
9
+        $this->table($this->roles, function(Blueprint $table) {
10 10
             $table->boolean('is_root')->default(false)->after('name');
11 11
         });
12 12
     }
13 13
 
14 14
     public function down()
15 15
     {
16
-        $this->table($this->roles, function (Blueprint $table) {
16
+        $this->table($this->roles, function(Blueprint $table) {
17 17
             $table->dropColumn('is_root');
18 18
         });
19 19
     }
Please login to merge, or discard this patch.
2020_06_04_000002_modify_roles_and_permissions_tables_remove_timestamps.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 
19 19
     protected function dropTimestamps(string $table)
20 20
     {
21
-        $this->table($table, function (Blueprint $table) {
21
+        $this->table($table, function(Blueprint $table) {
22 22
             $table->dropTimestamps();
23 23
         });
24 24
     }
25 25
 
26 26
     protected function createTimestamps(string $table)
27 27
     {
28
-        $this->table($table, function (Blueprint $table) {
28
+        $this->table($table, function(Blueprint $table) {
29 29
             $table->timestamps();
30 30
         });
31 31
     }
Please login to merge, or discard this patch.
2020_06_04_000003_modify_roles_and_permissions_table_optimize_indexes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     protected function optimizeIndexes(string $table, string $first_key, string $second_key)
20 20
     {
21
-        $this->table($table, function (Blueprint $table) use ($first_key, $second_key) {
21
+        $this->table($table, function(Blueprint $table) use ($first_key, $second_key) {
22 22
             $table->dropPrimary([$first_key, $second_key]);
23 23
 
24 24
             $table->index($first_key);
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     protected function revertIndexes(string $table, string $first_key, string $second_key)
29 29
     {
30
-        $this->table($table, function (Blueprint $table) use ($first_key, $second_key) {
30
+        $this->table($table, function(Blueprint $table) use ($first_key, $second_key) {
31 31
             $table->dropIndex($first_key);
32 32
 
33 33
             $table->primary([$first_key, $second_key]);
Please login to merge, or discard this patch.
migrations/2019_04_22_115951_create_roles_and_permissions_tables.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     protected function createTable(string $table)
27 27
     {
28
-        $this->create($table, function (Blueprint $table) {
28
+        $this->create($table, function(Blueprint $table) {
29 29
             $table->bigIncrements('id');
30 30
             $table->string('name')->unique();
31 31
             $table->timestamps();
Please login to merge, or discard this patch.
src/Support/Database/BaseMigration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 
68 68
     protected function createPivot(string $table, string $first_table, string $second_table, string $first_key, string $second_key)
69 69
     {
70
-        $this->create($table, function (Blueprint $table) use ($first_table, $second_table, $first_key, $second_key) {
70
+        $this->create($table, function(Blueprint $table) use ($first_table, $second_table, $first_key, $second_key) {
71 71
             $table->unsignedBigInteger($first_key);
72 72
             $table->unsignedBigInteger($second_key);
73 73
 
Please login to merge, or discard this patch.
src/Traits/HasRoles.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function hasRootRole(): bool
32 32
     {
33
-        return $this->cache(__FUNCTION__, function () {
33
+        return $this->cache(__FUNCTION__, function() {
34 34
             return $this->roles()
35 35
                 ->where('is_root', true)
36 36
                 ->exists();
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function hasRole(...$roles): bool
107 107
     {
108
-        return $this->cache(__FUNCTION__, function () use ($roles) {
108
+        return $this->cache(__FUNCTION__, function() use ($roles) {
109 109
             foreach (Arr::flatten($roles) as $role) {
110 110
                 if ($this->roles->contains('name', $role)) {
111 111
                     return true;
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function hasRoles(...$roles): bool
125 125
     {
126
-        return $this->cache(__FUNCTION__, function () use ($roles) {
126
+        return $this->cache(__FUNCTION__, function() use ($roles) {
127 127
             foreach (Arr::flatten($roles) as $role) {
128
-                if (! $this->roles->contains('name', $role)) {
128
+                if ( ! $this->roles->contains('name', $role)) {
129 129
                     return false;
130 130
                 }
131 131
             }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function hasPermission($permission): bool
212 212
     {
213
-        return $this->cache(__FUNCTION__, function () use ($permission) {
213
+        return $this->cache(__FUNCTION__, function() use ($permission) {
214 214
             $permission = $this->permissionId($permission);
215 215
 
216 216
             return $this->permissions()
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                     ->exists()
219 219
                 ||
220 220
                 $this->roles()
221
-                    ->whereHas('permissions', function (Builder $builder) use ($permission) {
221
+                    ->whereHas('permissions', function(Builder $builder) use ($permission) {
222 222
                         $builder->searchBy($permission);
223 223
                     })->exists();
224 224
         }, $permission);
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
      */
232 232
     public function hasPermissions(...$permissions): bool
233 233
     {
234
-        return $this->cache(__FUNCTION__, function () use ($permissions) {
234
+        return $this->cache(__FUNCTION__, function() use ($permissions) {
235 235
             foreach (Arr::flatten($permissions) as $permission) {
236
-                if (! $this->hasPermission($permission)) {
236
+                if ( ! $this->hasPermission($permission)) {
237 237
                     return false;
238 238
                 }
239 239
             }
Please login to merge, or discard this patch.