@@ -74,8 +74,8 @@ |
||
74 | 74 | */ |
75 | 75 | protected function getFormatedDate($date) |
76 | 76 | { |
77 | - if (! is_null($date)) { |
|
78 | - if (! $date instanceof Carbon) { |
|
77 | + if (!is_null($date)) { |
|
78 | + if (!$date instanceof Carbon) { |
|
79 | 79 | $date = Carbon::parse($date); |
80 | 80 | } |
81 | 81 |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | $this->controlActive = false; |
92 | 92 | |
93 | 93 | if ($this->isInitialize()) { |
94 | - $this->columns = $this->columns->filter(function ($column) { |
|
94 | + $this->columns = $this->columns->filter(function($column) { |
|
95 | 95 | $class = get_class($this->getControlColumn()); |
96 | 96 | |
97 | - return ! ($column instanceof $class); |
|
97 | + return !($column instanceof $class); |
|
98 | 98 | }); |
99 | 99 | } |
100 | 100 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function set($columns) |
118 | 118 | { |
119 | - if (! is_array($columns)) { |
|
119 | + if (!is_array($columns)) { |
|
120 | 120 | $columns = func_get_args(); |
121 | 121 | } |
122 | 122 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | public function initialize() |
164 | 164 | { |
165 | - $this->all()->each(function (ColumnInterface $column) { |
|
165 | + $this->all()->each(function(ColumnInterface $column) { |
|
166 | 166 | $column->initialize(); |
167 | 167 | }); |
168 | 168 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | $columns = $this->all(); |
206 | 206 | |
207 | - if (! is_int(key($orders))) { |
|
207 | + if (!is_int(key($orders))) { |
|
208 | 208 | $orders = [$orders]; |
209 | 209 | } |
210 | 210 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $columnIndex = array_get($order, 'column'); |
213 | 213 | $direction = array_get($order, 'dir', 'asc'); |
214 | 214 | |
215 | - if (! $columnIndex && $columnIndex !== '0') { |
|
215 | + if (!$columnIndex && $columnIndex !== '0') { |
|
216 | 216 | continue; |
217 | 217 | } |
218 | 218 |
@@ -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 | } |
@@ -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 |
@@ -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', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $totalCount = $query->count(); |
204 | 204 | $filteredCount = 0; |
205 | 205 | |
206 | - if (! is_null($this->distinct)) { |
|
206 | + if (!is_null($this->distinct)) { |
|
207 | 207 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
208 | 208 | } |
209 | 209 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | return; |
254 | 254 | } |
255 | 255 | |
256 | - $query->where(function (Builder $query) use ($search) { |
|
256 | + $query->where(function(Builder $query) use ($search) { |
|
257 | 257 | $columns = $this->getColumns()->all(); |
258 | 258 | |
259 | 259 | 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 | { |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | $admin->navigation()->setCurrentUrl($request->getUri()); |
62 | 62 | |
63 | - if (! $this->breadcrumbs->exists('home')) { |
|
64 | - $this->breadcrumbs->register('home', function (Generator $breadcrumbs) { |
|
63 | + if (!$this->breadcrumbs->exists('home')) { |
|
64 | + $this->breadcrumbs->register('home', function(Generator $breadcrumbs) { |
|
65 | 65 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
66 | 66 | }); |
67 | 67 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getDisplay(ModelConfigurationInterface $model) |
120 | 120 | { |
121 | - if (! $model->isDisplayable()) { |
|
121 | + if (!$model->isDisplayable()) { |
|
122 | 122 | abort(404); |
123 | 123 | } |
124 | 124 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getCreate(ModelConfigurationInterface $model) |
140 | 140 | { |
141 | - if (! $model->isCreatable()) { |
|
141 | + if (!$model->isCreatable()) { |
|
142 | 142 | abort(404); |
143 | 143 | } |
144 | 144 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function postStore(ModelConfigurationInterface $model, Request $request) |
160 | 160 | { |
161 | - if (! $model->isCreatable()) { |
|
161 | + if (!$model->isCreatable()) { |
|
162 | 162 | abort(404); |
163 | 163 | } |
164 | 164 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $redirectPolicy = $model->getRedirect(); |
197 | 197 | |
198 | 198 | /* Make redirect when use in model config && Fix editable redirect */ |
199 | - if ($redirectPolicy->get('create') == 'display' || ! $model->isEditable($newModel)) { |
|
199 | + if ($redirectPolicy->get('create') == 'display' || !$model->isEditable($newModel)) { |
|
200 | 200 | $redirectUrl = $model->getDisplayUrl(); |
201 | 201 | } |
202 | 202 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $item = $model->getRepository()->find($id); |
237 | 237 | |
238 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
238 | + if (is_null($item) || !$model->isEditable($item)) { |
|
239 | 239 | abort(404); |
240 | 240 | } |
241 | 241 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $editForm = $model->fireEdit($id); |
264 | 264 | $item = $editForm->getModel(); |
265 | 265 | |
266 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
266 | + if (is_null($item) || !$model->isEditable($item)) { |
|
267 | 267 | abort(404); |
268 | 268 | } |
269 | 269 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | /* @var ColumnEditableInterface|null $column */ |
344 | 344 | if (is_callable([$display, 'getColumns'])) { |
345 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
345 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
346 | 346 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
347 | 347 | })->first(); |
348 | 348 | } else { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $content = $tab->getContent(); |
352 | 352 | |
353 | 353 | if ($content instanceof DisplayTable) { |
354 | - $column = $content->getColumns()->all()->filter(function ($column) use ($field) { |
|
354 | + $column = $content->getColumns()->all()->filter(function($column) use ($field) { |
|
355 | 355 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
356 | 356 | })->first(); |
357 | 357 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | //Return data-table if inside FormElements |
362 | 362 | if ($element instanceof DisplayTable) { |
363 | - $column = $element->getColumns()->all()->filter(function ($column) use ($field) { |
|
363 | + $column = $element->getColumns()->all()->filter(function($column) use ($field) { |
|
364 | 364 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
365 | 365 | })->first(); |
366 | 366 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | if ($element instanceof Column) { |
370 | 370 | foreach ($element->getElements() as $columnElement) { |
371 | 371 | if ($columnElement instanceof DisplayTable) { |
372 | - $column = $columnElement->getColumns()->all()->filter(function ($column) use ($field) { |
|
372 | + $column = $columnElement->getColumns()->all()->filter(function($column) use ($field) { |
|
373 | 373 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
374 | 374 | })->first(); |
375 | 375 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $repository = $model->getRepository(); |
389 | 389 | $item = $repository->find($id); |
390 | 390 | |
391 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
391 | + if (is_null($item) || !$model->isEditable($item)) { |
|
392 | 392 | abort(404); |
393 | 393 | } |
394 | 394 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | { |
414 | 414 | $item = $model->getRepository()->find($id); |
415 | 415 | |
416 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
416 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
417 | 417 | abort(404); |
418 | 418 | } |
419 | 419 | |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id) |
444 | 444 | { |
445 | - if (! $model->isRestorableModel()) { |
|
445 | + if (!$model->isRestorableModel()) { |
|
446 | 446 | abort(404); |
447 | 447 | } |
448 | 448 | |
449 | 449 | $item = $model->getRepository()->findOnlyTrashed($id); |
450 | 450 | |
451 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
451 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
452 | 452 | abort(404); |
453 | 453 | } |
454 | 454 | |
@@ -477,13 +477,13 @@ discard block |
||
477 | 477 | */ |
478 | 478 | public function postRestore(ModelConfigurationInterface $model, Request $request, $id) |
479 | 479 | { |
480 | - if (! $model->isRestorableModel()) { |
|
480 | + if (!$model->isRestorableModel()) { |
|
481 | 481 | abort(404); |
482 | 482 | } |
483 | 483 | |
484 | 484 | $item = $model->getRepository()->findOnlyTrashed($id); |
485 | 485 | |
486 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
486 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
487 | 487 | abort(404); |
488 | 488 | } |
489 | 489 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | */ |
569 | 569 | protected function registerBreadcrumb($title, $parent) |
570 | 570 | { |
571 | - $this->breadcrumbs->register('render', function (Generator $breadcrumbs) use ($title, $parent) { |
|
571 | + $this->breadcrumbs->register('render', function(Generator $breadcrumbs) use ($title, $parent) { |
|
572 | 572 | $breadcrumbs->parent($parent); |
573 | 573 | $breadcrumbs->push($title); |
574 | 574 | }); |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | $this->breadCrumbsData = $this->breadCrumbsData + (array) $model->getBreadCrumbs(); |
585 | 585 | |
586 | 586 | foreach ($this->breadCrumbsData as $breadcrumb) { |
587 | - if (! $this->breadcrumbs->exists($breadcrumb['id'])) { |
|
588 | - $this->breadcrumbs->register($breadcrumb['id'], function (Generator $breadcrumbs) use ($breadcrumb) { |
|
587 | + if (!$this->breadcrumbs->exists($breadcrumb['id'])) { |
|
588 | + $this->breadcrumbs->register($breadcrumb['id'], function(Generator $breadcrumbs) use ($breadcrumb) { |
|
589 | 589 | $breadcrumbs->parent($breadcrumb['parent']); |
590 | 590 | $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
591 | 591 | }); |
@@ -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 |
@@ -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 | * |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | parent::initialize(); |
72 | 72 | |
73 | 73 | if ($this->getModelConfiguration()->isRestorableModel()) { |
74 | - $this->setApply(function (Builder $q) { |
|
74 | + $this->setApply(function(Builder $q) { |
|
75 | 75 | return $q->withTrashed(); |
76 | 76 | }); |
77 | 77 | } |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function getCollection() |
195 | 195 | { |
196 | - if (! $this->isInitialized()) { |
|
196 | + if (!$this->isInitialized()) { |
|
197 | 197 | throw new \Exception('Display is not initialized'); |
198 | 198 | } |
199 | 199 | |
200 | - if (! is_null($this->collection)) { |
|
200 | + if (!is_null($this->collection)) { |
|
201 | 201 | return $this->collection; |
202 | 202 | } |
203 | 203 |