Passed
Pull Request — master (#14)
by ARCANEDEV
06:46
created
src/Authorization/Http/Datatables/PermissionsDatatable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $search = $this->searchQuery($request);
71 71
 
72
-        return $query->unless(empty($search), function (Builder $q) use ($search): Builder {
72
+        return $query->unless(empty($search), function(Builder $q) use ($search): Builder {
73 73
             $permissionTable = Auth::table('permissions');
74 74
             $groupsTable     = Auth::table('permissions-groups');
75 75
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     protected function columns(): array
90 90
     {
91 91
         return [
92
-            Column::make('group', 'Group')->sortable(Column::SORT_ASC, function (Builder $query, Column $column): Builder {
92
+            Column::make('group', 'Group')->sortable(Column::SORT_ASC, function(Builder $query, Column $column): Builder {
93 93
                 $groupsTable = Auth::table('permissions-groups');
94 94
 
95 95
                 return $query->orderBy("{$groupsTable}.name", $column->getSortDirection());
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
     protected function actions(Request $request, $permission): array
125 125
     {
126 126
         return [
127
-            Action::link('show', 'Show', function () use ($permission) {
127
+            Action::link('show', 'Show', function() use ($permission) {
128 128
                 return route('admin::authorization.permissions.show', [$permission]);
129
-            })->can(function () use ($permission) {
129
+            })->can(function() use ($permission) {
130 130
                 return PermissionsPolicy::can('show', [$permission]);
131 131
             })->asIcon()
132 132
         ];
Please login to merge, or discard this patch.
src/Authorization/Http/Datatables/RolesDatatable.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $search = $this->searchQuery($request);
63 63
 
64
-        return $query->unless(empty($search), function (Builder $q) use ($search) {
64
+        return $query->unless(empty($search), function(Builder $q) use ($search) {
65 65
             return $q->where('name', 'like', '%'.$search.'%');
66 66
         });
67 67
     }
@@ -123,36 +123,36 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $actions = [];
125 125
 
126
-        $actions[] = Action::link('show', 'Show', function () use ($role) {
126
+        $actions[] = Action::link('show', 'Show', function() use ($role) {
127 127
             return route('admin::authorization.roles.show', [$role]);
128
-        })->can(function () use ($role) {
128
+        })->can(function() use ($role) {
129 129
             return RolesPolicy::can('show', [$role]);
130 130
         })->asIcon();
131 131
 
132
-        $actions[] = Action::link('edit', 'Edit', function () use ($role) {
132
+        $actions[] = Action::link('edit', 'Edit', function() use ($role) {
133 133
             return route('admin::authorization.roles.edit', [$role]);
134
-        })->can(function () use ($role) {
134
+        })->can(function() use ($role) {
135 135
             return RolesPolicy::can('update', [$role]);
136 136
         })->asIcon();
137 137
 
138 138
         if ($role->isActive()) {
139
-            $actions[] = Action::button('deactivate', 'Deactivate', function () use ($role) {
139
+            $actions[] = Action::button('deactivate', 'Deactivate', function() use ($role) {
140 140
                 return "ARCANESOFT.emit('authorization::roles.deactivate', {id: '{$role->getRouteKey()}'})";
141
-            })->can(function () use ($role) {
141
+            })->can(function() use ($role) {
142 142
                 return RolesPolicy::can('deactivate', [$role]);
143 143
             })->asIcon();
144 144
         }
145 145
         else {
146
-            $actions[] = Action::button('activate', 'Activate', function () use ($role) {
146
+            $actions[] = Action::button('activate', 'Activate', function() use ($role) {
147 147
                 return "ARCANESOFT.emit('authorization::roles.activate', {id: '{$role->getRouteKey()}'})";
148
-            })->can(function () use ($role) {
148
+            })->can(function() use ($role) {
149 149
                 return RolesPolicy::can('activate', [$role]);
150 150
             })->asIcon();
151 151
         }
152 152
 
153
-        $actions[] = Action::button('delete', 'Delete', function () use ($role) {
153
+        $actions[] = Action::button('delete', 'Delete', function() use ($role) {
154 154
             return "ARCANESOFT.emit('authorization::roles.delete', {id: '{$role->getRouteKey()}'})";
155
-        })->can(function () use ($role) {
155
+        })->can(function() use ($role) {
156 156
             return RolesPolicy::can('delete', [$role]);
157 157
         })->asIcon();
158 158
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,8 +141,7 @@
 block discarded – undo
141 141
             })->can(function () use ($role) {
142 142
                 return RolesPolicy::can('deactivate', [$role]);
143 143
             })->asIcon();
144
-        }
145
-        else {
144
+        } else {
146 145
             $actions[] = Action::button('activate', 'Activate', function () use ($role) {
147 146
                 return "ARCANESOFT.emit('authorization::roles.activate', {id: '{$role->getRouteKey()}'})";
148 147
             })->can(function () use ($role) {
Please login to merge, or discard this patch.
src/Datatable/Concerns/HasColumns.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function getDefaultSortByForQuery(): Closure
60 60
     {
61
-        return function (Builder $query, Column $column) {
62
-            return $query->orderBy($column->key(),$column->getSortDirection() ?: Column::SORT_ASC);
61
+        return function(Builder $query, Column $column) {
62
+            return $query->orderBy($column->key(), $column->getSortDirection() ?: Column::SORT_ASC);
63 63
         };
64 64
     }
65 65
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     protected function getDefaultSortByForCollection(): Closure
94 94
     {
95
-        return function (Collection $collection, Column $column, Request $request) {
95
+        return function(Collection $collection, Column $column, Request $request) {
96 96
             return $collection->sortBy(
97 97
                 $column->key(),
98 98
                 SORT_REGULAR,
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     protected function getColumnsMeta(): array
110 110
     {
111
-        $columns = array_map(function (Column $column)  {
111
+        $columns = array_map(function(Column $column) {
112 112
             return $column->toArray();
113 113
         }, $this->columns());
114 114
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $columns = $this->getSortableColumns();
152 152
         $sortedColumns = (array) $request->input('query.sort_by', []);
153 153
 
154
-        $results = array_map(function (array $sortedColumn) use ($columns): ?Column {
154
+        $results = array_map(function(array $sortedColumn) use ($columns): ?Column {
155 155
             foreach ($columns as $column) {
156 156
                 if ($sortedColumn['key'] === $column->key())
157 157
                     return $column->sortDirection($sortedColumn['direction']);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     protected function getSortByMeta(Request $request): array
174 174
     {
175
-        $columns = array_map(function (Column $column) {
175
+        $columns = array_map(function(Column $column) {
176 176
             return [
177 177
                 'key'       => $column->key(),
178 178
                 'direction' => $column->getSortDirection(),
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     protected function getSortableColumns(bool $withDirection = false): array
205 205
     {
206
-        $columns = array_filter($this->columns(), function (Column $column) use ($withDirection) {
206
+        $columns = array_filter($this->columns(), function(Column $column) use ($withDirection) {
207 207
             return $withDirection
208 208
                 ? ($column->isSortable() && $column->hasSortByDirection())
209 209
                 : $column->isSortable();
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,8 +112,9 @@  discard block
 block discarded – undo
112 112
             return $column->toArray();
113 113
         }, $this->columns());
114 114
 
115
-        if ($this->hasTrait(HasActions::class))
116
-            $columns[] = $this->getActionsColumnMeta();
115
+        if ($this->hasTrait(HasActions::class)) {
116
+                    $columns[] = $this->getActionsColumnMeta();
117
+        }
117 118
 
118 119
         return $columns;
119 120
     }
@@ -153,8 +154,9 @@  discard block
 block discarded – undo
153 154
 
154 155
         $results = array_map(function (array $sortedColumn) use ($columns): ?Column {
155 156
             foreach ($columns as $column) {
156
-                if ($sortedColumn['key'] === $column->key())
157
-                    return $column->sortDirection($sortedColumn['direction']);
157
+                if ($sortedColumn['key'] === $column->key()) {
158
+                                    return $column->sortDirection($sortedColumn['direction']);
159
+                }
158 160
             }
159 161
 
160 162
             return null;
Please login to merge, or discard this patch.
src/Datatable/Concerns/HasFilters.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     protected function getFiltersMeta(Request $request): array
39 39
     {
40
-        return array_map(function (Filter $filter) {
40
+        return array_map(function(Filter $filter) {
41 41
             return $filter->toArray();
42 42
         }, $this->filters($request));
43 43
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
     {
55 55
         $filtered = $this->filtersQuery($request);
56 56
 
57
-        if (empty($filtered))
58
-            return $resources;
57
+        if (empty($filtered)) {
58
+                    return $resources;
59
+        }
59 60
 
60 61
         foreach ($this->filters($request) as $filter) {
61 62
             if (isset($filtered[$filter->getName()])) {
Please login to merge, or discard this patch.
src/Datatable/Concerns/HasActions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      */
45 45
     protected function transformActions(Request $request, $resrouce): array
46 46
     {
47
-        return array_map(function (Action $action) {
47
+        return array_map(function(Action $action) {
48 48
             return $action->toArray();
49 49
         }, $this->actions($request, $resrouce));
50 50
     }
Please login to merge, or discard this patch.
src/Datatable/Column.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -243,14 +243,17 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function sortable(?string $direction = null, Closure $callback = null): self
245 245
     {
246
-        if ( ! $this->isSortable())
247
-            $this->sortable = true;
246
+        if ( ! $this->isSortable()) {
247
+                    $this->sortable = true;
248
+        }
248 249
 
249
-        if ($direction)
250
-            $this->sortDirection($direction);
250
+        if ($direction) {
251
+                    $this->sortDirection($direction);
252
+        }
251 253
 
252
-        if ($callback)
253
-            $this->sortQuery($callback);
254
+        if ($callback) {
255
+                    $this->sortQuery($callback);
256
+        }
254 257
 
255 258
         return $this;
256 259
     }
@@ -323,8 +326,9 @@  discard block
 block discarded – undo
323 326
      */
324 327
     public function hasSortByDirection(): bool
325 328
     {
326
-        if (is_null($this->direction))
327
-            return false;
329
+        if (is_null($this->direction)) {
330
+                    return false;
331
+        }
328 332
 
329 333
         return in_array(strtolower($this->direction), [static::SORT_ASC, static::SORT_DESC]);
330 334
     }
Please login to merge, or discard this patch.
src/Datatable/Filters/Select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function getOptions(): array
59 59
     {
60
-        return array_map(function (string $option) {
60
+        return array_map(function(string $option) {
61 61
             return __($option);
62 62
         }, $this->options);
63 63
     }
Please login to merge, or discard this patch.
src/Datatable/Filter.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,8 +154,9 @@
 block discarded – undo
154 154
      */
155 155
     public function apply($resources, $value)
156 156
     {
157
-        if ($this->getValue() === $value)
158
-            return $resources;
157
+        if ($this->getValue() === $value) {
158
+                    return $resources;
159
+        }
159 160
 
160 161
         return ($this->query)($resources, $value);
161 162
     }
Please login to merge, or discard this patch.
src/Datatable/Action.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
      */
246 246
     public function toArray(): array
247 247
     {
248
-        return with(app(), function (Application $app) {
248
+        return with(app(), function(Application $app) {
249 249
             $allowed = $app->call($this->condition);
250 250
 
251 251
             return [
Please login to merge, or discard this patch.