@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function set($columnFilters) |
37 | 37 | { |
38 | - if (! is_array($columnFilters)) { |
|
38 | + if (!is_array($columnFilters)) { |
|
39 | 39 | $columnFilters = func_get_args(); |
40 | 40 | } |
41 | 41 | |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | |
174 | 174 | $display = $this->getDisplay(); |
175 | 175 | |
176 | - if (! $display->getExtensions()->has('columns')) { |
|
176 | + if (!$display->getExtensions()->has('columns')) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
180 | 180 | $columns = $display->getColumns()->all(); |
181 | 181 | |
182 | - if (! is_int(key($search))) { |
|
182 | + if (!is_int(key($search))) { |
|
183 | 183 | $search = [$search]; |
184 | 184 | } |
185 | 185 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | protected function prepareView() |
218 | 218 | { |
219 | - if (! in_array($this->getPlacement(), ['table.footer', 'table.header']) && $this->view == 'display.extensions.columns_filters_table') { |
|
219 | + if (!in_array($this->getPlacement(), ['table.footer', 'table.header']) && $this->view == 'display.extensions.columns_filters_table') { |
|
220 | 220 | $this->view = 'display.extensions.columns_filters'; |
221 | 221 | $this->setHtmlAttribute('class', 'table table-default'); |
222 | 222 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | parent::initialize(); |
71 | 71 | |
72 | 72 | if ($this->getModelConfiguration()->isRestorableModel()) { |
73 | - $this->setApply(function ($q) { |
|
73 | + $this->setApply(function($q) { |
|
74 | 74 | return $q->withTrashed(); |
75 | 75 | }); |
76 | 76 | } |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function getCollection() |
194 | 194 | { |
195 | - if (! $this->isInitialized()) { |
|
195 | + if (!$this->isInitialized()) { |
|
196 | 196 | throw new \Exception('Display is not initialized'); |
197 | 197 | } |
198 | 198 | |
199 | - if (! is_null($this->collection)) { |
|
199 | + if (!is_null($this->collection)) { |
|
200 | 200 | return $this->collection; |
201 | 201 | } |
202 | 202 |
@@ -12,7 +12,6 @@ |
||
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class DisplayTable. |
15 | - |
|
16 | 15 | * @method Columns getColumns() |
17 | 16 | * @method $this setColumns(ColumnInterface|ColumnInterface[] $column) |
18 | 17 | * |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function placable() |
17 | 17 | { |
18 | - return $this->filter(function (DisplayExtensionInterface $extension) { |
|
18 | + return $this->filter(function(DisplayExtensionInterface $extension) { |
|
19 | 19 | return $extension instanceof Placable; |
20 | 20 | }); |
21 | 21 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function renderable() |
44 | 44 | { |
45 | - return $this->filter(function (DisplayExtensionInterface $extension) { |
|
45 | + return $this->filter(function(DisplayExtensionInterface $extension) { |
|
46 | 46 | return $extension instanceof Renderable; |
47 | 47 | }); |
48 | 48 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function sortByOrder() |
54 | 54 | { |
55 | - return $this->sortBy(function (DisplayExtensionInterface $extension) { |
|
55 | + return $this->sortBy(function(DisplayExtensionInterface $extension) { |
|
56 | 56 | return $extension->getOrder(); |
57 | 57 | }); |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function initialize() |
64 | 64 | { |
65 | - $this->each(function (DisplayExtensionInterface $extension) { |
|
65 | + $this->each(function(DisplayExtensionInterface $extension) { |
|
66 | 66 | if ($extension instanceof Initializable) { |
67 | 67 | $extension->initialize(); |
68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
78 | 78 | { |
79 | - $this->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
79 | + $this->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
80 | 80 | $extension->modifyQuery($query); |
81 | 81 | }); |
82 | 82 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function initializeElements() |
25 | 25 | { |
26 | - $this->getElements()->each(function ($element) { |
|
26 | + $this->getElements()->each(function($element) { |
|
27 | 27 | if ($element instanceof Initializable) { |
28 | 28 | $element->initialize(); |
29 | 29 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | foreach ($this->getElements() as $element) { |
43 | 43 | if ($element instanceof ElementsInterface) { |
44 | - if (! is_null($found = $element->getElement($path))) { |
|
44 | + if (!is_null($found = $element->getElement($path))) { |
|
45 | 45 | return $found; |
46 | 46 | } |
47 | 47 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function setModelForElements(Model $model) |
147 | 147 | { |
148 | - $this->getElements()->each(function ($element) use ($model) { |
|
148 | + $this->getElements()->each(function($element) use ($model) { |
|
149 | 149 | $element = $this->getElementContainer($element); |
150 | 150 | |
151 | 151 | if ($element instanceof WithModel) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getValidationRulesFromElements(array $rules = []) |
165 | 165 | { |
166 | - $this->getElements()->onlyActive()->each(function ($element) use (&$rules) { |
|
166 | + $this->getElements()->onlyActive()->each(function($element) use (&$rules) { |
|
167 | 167 | $element = $this->getElementContainer($element); |
168 | 168 | |
169 | 169 | if ($element instanceof Validable) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function getValidationMessagesForElements(array $messages = []) |
183 | 183 | { |
184 | - $this->getElements()->onlyActive()->each(function ($element) use (&$messages) { |
|
184 | + $this->getElements()->onlyActive()->each(function($element) use (&$messages) { |
|
185 | 185 | $element = $this->getElementContainer($element); |
186 | 186 | |
187 | 187 | if ($element instanceof Validable) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function getValidationLabelsForElements(array $labels = []) |
201 | 201 | { |
202 | - $this->getElements()->onlyActive()->each(function ($element) use (&$labels) { |
|
202 | + $this->getElements()->onlyActive()->each(function($element) use (&$labels) { |
|
203 | 203 | $element = $this->getElementContainer($element); |
204 | 204 | |
205 | 205 | if ($element instanceof Validable) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function saveElements(\Illuminate\Http\Request $request) |
219 | 219 | { |
220 | - $this->getElements()->onlyActive()->each(function ($element) use ($request) { |
|
220 | + $this->getElements()->onlyActive()->each(function($element) use ($request) { |
|
221 | 221 | $element = $this->getElementContainer($element); |
222 | 222 | |
223 | 223 | if ($element instanceof FormElementInterface) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function afterSaveElements(\Illuminate\Http\Request $request) |
235 | 235 | { |
236 | - $this->getElements()->onlyActive()->each(function ($element) use ($request) { |
|
236 | + $this->getElements()->onlyActive()->each(function($element) use ($request) { |
|
237 | 237 | $element = $this->getElementContainer($element); |
238 | 238 | |
239 | 239 | if ($element instanceof FormElementInterface) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | - * @param mixed $distinct |
|
121 | + * @param string|null $distinct |
|
122 | 122 | * |
123 | 123 | * @return $this |
124 | 124 | */ |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * Apply offset and limit to the query. |
164 | 164 | * |
165 | - * @param $query |
|
165 | + * @param Builder $query |
|
166 | 166 | * @param \Illuminate\Http\Request $request |
167 | 167 | */ |
168 | 168 | protected function applyOffset($query, \Illuminate\Http\Request $request) |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * Convert collection to the datatables structure. |
205 | 205 | * |
206 | 206 | * @param \Illuminate\Http\Request $request |
207 | - * @param array|Collection $collection |
|
207 | + * @param Collection $collection |
|
208 | 208 | * @param int $totalCount |
209 | 209 | * @param int $filteredCount |
210 | 210 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function registerRoutes(Router $router) |
27 | 27 | { |
28 | 28 | $routeName = 'admin.display.async'; |
29 | - if (! $router->has($routeName)) { |
|
29 | + if (!$router->has($routeName)) { |
|
30 | 30 | $router->get('{adminModel}/async/{adminDisplayName?}', [ |
31 | 31 | 'as' => $routeName, |
32 | 32 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@async', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | $routeName = 'admin.display.async.inlineEdit'; |
37 | - if (! $router->has($routeName)) { |
|
37 | + if (!$router->has($routeName)) { |
|
38 | 38 | $router->post('{adminModel}/async/{adminDisplayName?}', [ |
39 | 39 | 'as' => $routeName, |
40 | 40 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\AdminController@inlineEdit', |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $totalCount = $query->count(); |
176 | 176 | $filteredCount = 0; |
177 | 177 | |
178 | - if (! is_null($this->distinct)) { |
|
178 | + if (!is_null($this->distinct)) { |
|
179 | 179 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
180 | 180 | } |
181 | 181 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - $query->where(function ($query) use ($search) { |
|
226 | + $query->where(function($query) use ($search) { |
|
227 | 227 | $columns = $this->getColumns()->all(); |
228 | 228 | |
229 | 229 | foreach ($columns as $column) { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @param ModelConfigurationInterface $model |
312 | 312 | * @param Request $request |
313 | 313 | * |
314 | - * @return bool |
|
314 | + * @return boolean|null |
|
315 | 315 | * |
316 | 316 | * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
317 | 317 | */ |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | /** |
535 | 535 | * @param Request $request |
536 | 536 | * |
537 | - * @return null|string |
|
537 | + * @return string |
|
538 | 538 | */ |
539 | 539 | protected function getBackUrl(Request $request) |
540 | 540 | { |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | $admin->navigation()->setCurrentUrl($request->getUri()); |
56 | 56 | |
57 | - if (! $this->breadcrumbs->exists('home')) { |
|
58 | - $this->breadcrumbs->register('home', function ($breadcrumbs) { |
|
57 | + if (!$this->breadcrumbs->exists('home')) { |
|
58 | + $this->breadcrumbs->register('home', function($breadcrumbs) { |
|
59 | 59 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
60 | 60 | }); |
61 | 61 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | foreach ($breadcrumbs as $breadcrumb) { |
79 | - if (! $this->breadcrumbs->exists($breadcrumb['id'])) { |
|
80 | - $this->breadcrumbs->register($breadcrumb['id'], function ($breadcrumbs) use ($breadcrumb) { |
|
79 | + if (!$this->breadcrumbs->exists($breadcrumb['id'])) { |
|
80 | + $this->breadcrumbs->register($breadcrumb['id'], function($breadcrumbs) use ($breadcrumb) { |
|
81 | 81 | $breadcrumbs->parent($breadcrumb['parent']); |
82 | 82 | $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
83 | 83 | }); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getDisplay(ModelConfigurationInterface $model) |
123 | 123 | { |
124 | - if (! $model->isDisplayable()) { |
|
124 | + if (!$model->isDisplayable()) { |
|
125 | 125 | abort(404); |
126 | 126 | } |
127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getCreate(ModelConfigurationInterface $model) |
139 | 139 | { |
140 | - if (! $model->isCreatable()) { |
|
140 | + if (!$model->isCreatable()) { |
|
141 | 141 | abort(404); |
142 | 142 | } |
143 | 143 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function postStore(ModelConfigurationInterface $model, Request $request) |
158 | 158 | { |
159 | - if (! $model->isCreatable()) { |
|
159 | + if (!$model->isCreatable()) { |
|
160 | 160 | abort(404); |
161 | 161 | } |
162 | 162 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $redirectPolicy = $model->getRedirect(); |
195 | 195 | |
196 | 196 | /* Make redirect when use in model config && Fix editable redirect */ |
197 | - if ($redirectPolicy->get('create') == 'display' || ! $model->isEditable($newModel)) { |
|
197 | + if ($redirectPolicy->get('create') == 'display' || !$model->isEditable($newModel)) { |
|
198 | 198 | $redirectUrl = $model->getDisplayUrl(); |
199 | 199 | } |
200 | 200 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | { |
234 | 234 | $item = $model->getRepository()->find($id); |
235 | 235 | |
236 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
236 | + if (is_null($item) || !$model->isEditable($item)) { |
|
237 | 237 | abort(404); |
238 | 238 | } |
239 | 239 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $editForm = $model->fireEdit($id); |
258 | 258 | $item = $editForm->getModel(); |
259 | 259 | |
260 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
260 | + if (is_null($item) || !$model->isEditable($item)) { |
|
261 | 261 | abort(404); |
262 | 262 | } |
263 | 263 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | /* @var ColumnEditableInterface|null $column */ |
338 | 338 | if (is_callable([$display, 'getColumns'])) { |
339 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
339 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
340 | 340 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
341 | 341 | })->first(); |
342 | 342 | } else { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $content = $tab->getContent(); |
346 | 346 | |
347 | 347 | if ($content instanceof DisplayTable) { |
348 | - $column = $content->getColumns()->all()->filter(function ($column) use ($field) { |
|
348 | + $column = $content->getColumns()->all()->filter(function($column) use ($field) { |
|
349 | 349 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
350 | 350 | })->first(); |
351 | 351 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | //Return data-table if inside FormElements |
356 | 356 | if ($element instanceof DisplayTable) { |
357 | - $column = $element->getColumns()->all()->filter(function ($column) use ($field) { |
|
357 | + $column = $element->getColumns()->all()->filter(function($column) use ($field) { |
|
358 | 358 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
359 | 359 | })->first(); |
360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | if ($element instanceof Column) { |
364 | 364 | foreach ($element->getElements() as $columnElement) { |
365 | 365 | if ($columnElement instanceof DisplayTable) { |
366 | - $column = $columnElement->getColumns()->all()->filter(function ($column) use ($field) { |
|
366 | + $column = $columnElement->getColumns()->all()->filter(function($column) use ($field) { |
|
367 | 367 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
368 | 368 | })->first(); |
369 | 369 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $repository = $model->getRepository(); |
383 | 383 | $item = $repository->find($id); |
384 | 384 | |
385 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
385 | + if (is_null($item) || !$model->isEditable($item)) { |
|
386 | 386 | abort(404); |
387 | 387 | } |
388 | 388 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | { |
410 | 410 | $item = $model->getRepository()->find($id); |
411 | 411 | |
412 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
412 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
413 | 413 | abort(404); |
414 | 414 | } |
415 | 415 | |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | */ |
439 | 439 | public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id) |
440 | 440 | { |
441 | - if (! $model->isRestorableModel()) { |
|
441 | + if (!$model->isRestorableModel()) { |
|
442 | 442 | abort(404); |
443 | 443 | } |
444 | 444 | |
445 | 445 | $item = $model->getRepository()->findOnlyTrashed($id); |
446 | 446 | |
447 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
447 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
448 | 448 | abort(404); |
449 | 449 | } |
450 | 450 | |
@@ -473,13 +473,13 @@ discard block |
||
473 | 473 | */ |
474 | 474 | public function postRestore(ModelConfigurationInterface $model, Request $request, $id) |
475 | 475 | { |
476 | - if (! $model->isRestorableModel()) { |
|
476 | + if (!$model->isRestorableModel()) { |
|
477 | 477 | abort(404); |
478 | 478 | } |
479 | 479 | |
480 | 480 | $item = $model->getRepository()->findOnlyTrashed($id); |
481 | 481 | |
482 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
482 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
483 | 483 | abort(404); |
484 | 484 | } |
485 | 485 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | */ |
565 | 565 | protected function registerBreadcrumb($title, $parent) |
566 | 566 | { |
567 | - $this->breadcrumbs->register('render', function ($breadcrumbs) use ($title, $parent) { |
|
567 | + $this->breadcrumbs->register('render', function($breadcrumbs) use ($title, $parent) { |
|
568 | 568 | $breadcrumbs->parent($parent); |
569 | 569 | $breadcrumbs->push($title); |
570 | 570 | }); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | list($name, $params) = $this->currentRoute->get(); |
35 | 35 | } |
36 | 36 | |
37 | - if (! $this->exists($name)) { |
|
37 | + if (!$this->exists($name)) { |
|
38 | 38 | return ''; |
39 | 39 | } |
40 | 40 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function renderIfExistsArray($name, $params = []) |
62 | 62 | { |
63 | - if (! $this->exists($name)) { |
|
63 | + if (!$this->exists($name)) { |
|
64 | 64 | return ''; |
65 | 65 | } |
66 | 66 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | parent::__construct($name, $title); |
23 | 23 | |
24 | - if (! is_null($callback)) { |
|
24 | + if (!is_null($callback)) { |
|
25 | 25 | $this->setCallback($callback); |
26 | 26 | } |
27 | 27 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function __construct($label = null, Closure $callback = null) |
33 | 33 | { |
34 | 34 | parent::__construct($label); |
35 | - if (! is_null($callback)) { |
|
35 | + if (!is_null($callback)) { |
|
36 | 36 | $this->setCallback($callback); |
37 | 37 | } |
38 | 38 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getModelValue() |
68 | 68 | { |
69 | - if (! is_callable($callback = $this->getCallback())) { |
|
69 | + if (!is_callable($callback = $this->getCallback())) { |
|
70 | 70 | throw new \Exception('Invalid custom column callback'); |
71 | 71 | } |
72 | 72 |