@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * |
247 | 247 | * @param Request $request |
248 | 248 | * |
249 | - * @return bool |
|
249 | + * @return boolean|null |
|
250 | 250 | */ |
251 | 251 | public function inlineEdit(ModelConfigurationInterface $model, Request $request) |
252 | 252 | { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
348 | - * @param ModelConfigurationInterface|ModelConfiguration $model |
|
348 | + * @param ModelConfigurationInterface $model |
|
349 | 349 | * @param Request $request |
350 | 350 | * @param int $id |
351 | 351 | * |
@@ -39,35 +39,35 @@ discard block |
||
39 | 39 | public function __construct(Request $request, \Illuminate\Contracts\Foundation\Application $application) |
40 | 40 | { |
41 | 41 | $this->application = $application; |
42 | - $this->navigation = $application['sleeping_owl.navigation']; |
|
42 | + $this->navigation = $application[ 'sleeping_owl.navigation' ]; |
|
43 | 43 | $this->navigation->setCurrentUrl($request->url()); |
44 | 44 | |
45 | - if (! Breadcrumbs::exists('home')) { |
|
46 | - Breadcrumbs::register('home', function ($breadcrumbs) { |
|
45 | + if (!Breadcrumbs::exists('home')) { |
|
46 | + Breadcrumbs::register('home', function($breadcrumbs) { |
|
47 | 47 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
48 | 48 | }); |
49 | 49 | } |
50 | 50 | |
51 | - $breadcrumbs = []; |
|
51 | + $breadcrumbs = [ ]; |
|
52 | 52 | |
53 | 53 | if ($currentPage = $this->navigation->getCurrentPage()) { |
54 | 54 | foreach ($currentPage->getPathArray() as $page) { |
55 | - $breadcrumbs[] = [ |
|
56 | - 'id' => $page['id'], |
|
57 | - 'title' => $page['title'], |
|
58 | - 'url' => $page['url'], |
|
55 | + $breadcrumbs[ ] = [ |
|
56 | + 'id' => $page[ 'id' ], |
|
57 | + 'title' => $page[ 'title' ], |
|
58 | + 'url' => $page[ 'url' ], |
|
59 | 59 | 'parent' => $this->parentBreadcrumb, |
60 | 60 | ]; |
61 | 61 | |
62 | - $this->parentBreadcrumb = $page['id']; |
|
62 | + $this->parentBreadcrumb = $page[ 'id' ]; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | 66 | foreach ($breadcrumbs as $breadcrumb) { |
67 | - if (! Breadcrumbs::exists($breadcrumb['id'])) { |
|
68 | - Breadcrumbs::register($breadcrumb['id'], function ($breadcrumbs) use ($breadcrumb) { |
|
69 | - $breadcrumbs->parent($breadcrumb['parent']); |
|
70 | - $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
|
67 | + if (!Breadcrumbs::exists($breadcrumb[ 'id' ])) { |
|
68 | + Breadcrumbs::register($breadcrumb[ 'id' ], function($breadcrumbs) use ($breadcrumb) { |
|
69 | + $breadcrumbs->parent($breadcrumb[ 'parent' ]); |
|
70 | + $breadcrumbs->push($breadcrumb[ 'title' ], $breadcrumb[ 'url' ]); |
|
71 | 71 | }); |
72 | 72 | } |
73 | 73 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getDisplay(ModelConfigurationInterface $model) |
109 | 109 | { |
110 | - if (! $model->isDisplayable()) { |
|
110 | + if (!$model->isDisplayable()) { |
|
111 | 111 | abort(404); |
112 | 112 | } |
113 | 113 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getCreate(ModelConfigurationInterface $model) |
123 | 123 | { |
124 | - if (! $model->isCreatable()) { |
|
124 | + if (!$model->isCreatable()) { |
|
125 | 125 | abort(404); |
126 | 126 | } |
127 | 127 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function postStore(ModelConfigurationInterface $model, Request $request) |
141 | 141 | { |
142 | - if (! $model->isCreatable()) { |
|
142 | + if (!$model->isCreatable()) { |
|
143 | 143 | abort(404); |
144 | 144 | } |
145 | 145 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $redirectPolicy = $model->getRedirect(); |
174 | 174 | |
175 | 175 | /* Make redirect when use in model config && Fix editable redirect */ |
176 | - if ($redirectPolicy->get('create') == 'display' || ! $model->isEditable($newModel)) { |
|
176 | + if ($redirectPolicy->get('create') == 'display' || !$model->isEditable($newModel)) { |
|
177 | 177 | $redirectUrl = $model->getDisplayUrl(); |
178 | 178 | } |
179 | 179 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | $item = $model->getRepository()->find($id); |
210 | 210 | |
211 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
211 | + if (is_null($item) || !$model->isEditable($item)) { |
|
212 | 212 | abort(404); |
213 | 213 | } |
214 | 214 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $editForm = $model->fireEdit($id); |
231 | 231 | $item = $editForm->getModel(); |
232 | 232 | |
233 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
233 | + if (is_null($item) || !$model->isEditable($item)) { |
|
234 | 234 | abort(404); |
235 | 235 | } |
236 | 236 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $display = $model->fireDisplay(); |
300 | 300 | |
301 | 301 | /** @var ColumnEditableInterface|null $column */ |
302 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
302 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
303 | 303 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
304 | 304 | })->first(); |
305 | 305 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $repository = $model->getRepository(); |
311 | 311 | $item = $repository->find($id); |
312 | 312 | |
313 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
313 | + if (is_null($item) || !$model->isEditable($item)) { |
|
314 | 314 | abort(404); |
315 | 315 | } |
316 | 316 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | { |
336 | 336 | $item = $model->getRepository()->find($id); |
337 | 337 | |
338 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
338 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
339 | 339 | abort(404); |
340 | 340 | } |
341 | 341 | |
@@ -362,13 +362,13 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id) |
364 | 364 | { |
365 | - if (! $model->isRestorableModel()) { |
|
365 | + if (!$model->isRestorableModel()) { |
|
366 | 366 | abort(404); |
367 | 367 | } |
368 | 368 | |
369 | 369 | $item = $model->getRepository()->findOnlyTrashed($id); |
370 | 370 | |
371 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
371 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
372 | 372 | abort(404); |
373 | 373 | } |
374 | 374 | |
@@ -395,13 +395,13 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function postRestore(ModelConfigurationInterface $model, Request $request, $id) |
397 | 397 | { |
398 | - if (! $model->isRestorableModel()) { |
|
398 | + if (!$model->isRestorableModel()) { |
|
399 | 399 | abort(404); |
400 | 400 | } |
401 | 401 | |
402 | 402 | $item = $model->getRepository()->findOnlyTrashed($id); |
403 | 403 | |
404 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
404 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
405 | 405 | abort(404); |
406 | 406 | } |
407 | 407 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | { |
468 | 468 | $lang = trans('sleeping_owl::lang'); |
469 | 469 | if ($lang == 'sleeping_owl::lang') { |
470 | - $lang = trans('sleeping_owl::lang', [], 'messages', 'en'); |
|
470 | + $lang = trans('sleeping_owl::lang', [ ], 'messages', 'en'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | $data = [ |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | { |
511 | 511 | if (($backUrl = $request->input('_redirectBack')) == \URL::previous()) { |
512 | 512 | $backUrl = null; |
513 | - $request->merge(['_redirectBack' => $backUrl]); |
|
513 | + $request->merge([ '_redirectBack' => $backUrl ]); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | return $backUrl; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | */ |
528 | 528 | protected function registerBreadcrumb($title, $parent) |
529 | 529 | { |
530 | - Breadcrumbs::register('render', function ($breadcrumbs) use ($title, $parent) { |
|
530 | + Breadcrumbs::register('render', function($breadcrumbs) use ($title, $parent) { |
|
531 | 531 | $breadcrumbs->parent($parent); |
532 | 532 | $breadcrumbs->push($title); |
533 | 533 | }); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @var array |
25 | 25 | */ |
26 | - protected $options = []; |
|
26 | + protected $options = [ ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @var bool |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * @var array |
45 | 45 | */ |
46 | - protected $exclude = []; |
|
46 | + protected $exclude = [ ]; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @var string|null |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - protected $fetchColumns = []; |
|
56 | + protected $fetchColumns = [ ]; |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @var function|\Closure|object callable |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param string|null $label |
66 | 66 | * @param array|Model $options |
67 | 67 | */ |
68 | - public function __construct($path, $label = null, $options = []) |
|
68 | + public function __construct($path, $label = null, $options = [ ]) |
|
69 | 69 | { |
70 | 70 | parent::__construct($path, $label); |
71 | 71 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $modelForOptions = app($modelForOptions); |
97 | 97 | } |
98 | 98 | |
99 | - if (! ($modelForOptions instanceof Model)) { |
|
99 | + if (!($modelForOptions instanceof Model)) { |
|
100 | 100 | throw new SelectException('Class must be instanced of Illuminate\Database\Eloquent\Model'); |
101 | 101 | } |
102 | 102 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getOptions() |
132 | 132 | { |
133 | - if (! is_null($this->getModelForOptions()) && ! is_null($this->getDisplay())) { |
|
133 | + if (!is_null($this->getModelForOptions()) && !is_null($this->getDisplay())) { |
|
134 | 134 | $this->loadOptions(); |
135 | 135 | } |
136 | 136 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setFetchColumns($columns) |
239 | 239 | { |
240 | - if (! is_array($columns)) { |
|
240 | + if (!is_array($columns)) { |
|
241 | 241 | $columns = func_get_args(); |
242 | 242 | } |
243 | 243 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function exclude($keys) |
300 | 300 | { |
301 | - if (! is_array($keys)) { |
|
301 | + if (!is_array($keys)) { |
|
302 | 302 | $keys = func_get_args(); |
303 | 303 | } |
304 | 304 | |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | ]; |
345 | 345 | |
346 | 346 | if ($this->isReadonly()) { |
347 | - $attributes['disabled'] = 'disabled'; |
|
347 | + $attributes[ 'disabled' ] = 'disabled'; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | $options = $this->getOptions(); |
351 | 351 | |
352 | 352 | if ($this->isNullable()) { |
353 | - $attributes['data-nullable'] = 'true'; |
|
354 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
353 | + $attributes[ 'data-nullable' ] = 'true'; |
|
354 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $options = array_except($options, $this->exclude); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | protected function loadOptions() |
370 | 370 | { |
371 | - $repository = app(RepositoryInterface::class, [$this->getModelForOptions()]); |
|
371 | + $repository = app(RepositoryInterface::class, [ $this->getModelForOptions() ]); |
|
372 | 372 | |
373 | 373 | $key = $repository->getModel()->getKeyName(); |
374 | 374 | |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | } |
380 | 380 | |
381 | 381 | if (count($this->fetchColumns) > 0) { |
382 | - $columns = array_merge([$key], $this->fetchColumns); |
|
382 | + $columns = array_merge([ $key ], $this->fetchColumns); |
|
383 | 383 | $options->select($columns); |
384 | 384 | } |
385 | 385 | |
386 | 386 | // call the pre load options query preparer if has be set |
387 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
387 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
388 | 388 | $options = $preparer($this, $options); |
389 | 389 | } |
390 | 390 | |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | |
402 | 402 | // iterate for all options and redefine it as |
403 | 403 | // list of KEY and TEXT pair |
404 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
404 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
405 | 405 | // get the KEY and make the display text |
406 | - return [data_get($opt, $key), $makeDisplay($opt)]; |
|
406 | + return [ data_get($opt, $key), $makeDisplay($opt) ]; |
|
407 | 407 | }, $options); |
408 | 408 | |
409 | 409 | // take options as array with KEY => VALUE pair |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | { |
56 | 56 | $this->content = $content; |
57 | 57 | |
58 | - if (! is_null($label)) { |
|
58 | + if (!is_null($label)) { |
|
59 | 59 | $this->setLabel($label); |
60 | 60 | } |
61 | 61 | |
62 | - if (! is_null($icon)) { |
|
62 | + if (!is_null($icon)) { |
|
63 | 63 | $this->setIcon($icon); |
64 | 64 | } |
65 | 65 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | return $this->getContent()->getValidationRules(); |
308 | 308 | } |
309 | 309 | |
310 | - return []; |
|
310 | + return [ ]; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | return $this->getContent()->getValidationMessages(); |
320 | 320 | } |
321 | 321 | |
322 | - return []; |
|
322 | + return [ ]; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return $this->getContent()->getValidationLabels(); |
332 | 332 | } |
333 | 333 | |
334 | - return []; |
|
334 | + return [ ]; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -209,6 +209,7 @@ |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
212 | + * @param string $format |
|
212 | 213 | * @return string |
213 | 214 | */ |
214 | 215 | protected function generatePickerFormat($format) |
@@ -182,7 +182,7 @@ |
||
182 | 182 | $fieldName = array_pop($parts); |
183 | 183 | $relationName = implode('.', $parts); |
184 | 184 | |
185 | - $query->whereHas($relationName, function ($q) use ($name, $date) { |
|
185 | + $query->whereHas($relationName, function($q) use ($name, $date) { |
|
186 | 186 | $this->buildQuery($q, $name, $date); |
187 | 187 | }); |
188 | 188 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * @param mixed $distinct |
|
166 | + * @param string|null $distinct |
|
167 | 167 | * |
168 | 168 | * @return $this |
169 | 169 | */ |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Apply offset and limit to the query. |
208 | 208 | * |
209 | - * @param $query |
|
209 | + * @param Builder $query |
|
210 | 210 | */ |
211 | 211 | protected function applyOffset($query) |
212 | 212 | { |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * Convert collection to the datatables structure. |
269 | 269 | * |
270 | - * @param array|Collection $collection |
|
270 | + * @param Collection $collection |
|
271 | 271 | * @param int $totalCount |
272 | 272 | * @param int $filteredCount |
273 | 273 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $router->get('{adminModel}/async/{adminDisplayName?}', [ |
28 | 28 | 'as' => 'admin.model.async', |
29 | - function (ModelConfigurationInterface $model, $name = null) { |
|
29 | + function(ModelConfigurationInterface $model, $name = null) { |
|
30 | 30 | $display = $model->fireDisplay(); |
31 | 31 | if ($display instanceof DisplayTabbed) { |
32 | 32 | $display = static::findDatatablesAsyncByName($display, $name); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ]); |
42 | 42 | $router->post('{adminModel}/async/{adminDisplayName?}', [ |
43 | 43 | 'as' => 'admin.model.async.inline', |
44 | - function (ModelConfigurationInterface $model, InlineRequest $request) { |
|
44 | + function(ModelConfigurationInterface $model, InlineRequest $request) { |
|
45 | 45 | $field = $request->input('name'); |
46 | 46 | $value = $request->input('value'); |
47 | 47 | $id = $request->input('pk'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $display = $model->fireDisplay(); |
50 | 50 | |
51 | 51 | /** @var ColumnEditableInterface|null $column */ |
52 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
52 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
53 | 53 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
54 | 54 | })->first(); |
55 | 55 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $totalCount = $query->count(); |
185 | 185 | $filteredCount = 0; |
186 | 186 | |
187 | - if (! is_null($this->distinct)) { |
|
187 | + if (!is_null($this->distinct)) { |
|
188 | 188 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
189 | 189 | } |
190 | 190 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return; |
233 | 233 | } |
234 | 234 | |
235 | - $query->where(function ($query) use ($search) { |
|
235 | + $query->where(function($query) use ($search) { |
|
236 | 236 | $columns = $this->getColumns()->all(); |
237 | 237 | foreach ($columns as $column) { |
238 | 238 | if (in_array(get_class($column), $this->searchableColumns)) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | protected function applyColumnSearch(Builder $query) |
252 | 252 | { |
253 | - $queryColumns = Request::input('columns', []); |
|
253 | + $queryColumns = Request::input('columns', [ ]); |
|
254 | 254 | |
255 | 255 | foreach ($queryColumns as $index => $queryColumn) { |
256 | 256 | $search = array_get($queryColumn, 'search.value'); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $column = $this->getColumns()->all()->get($index); |
259 | 259 | $columnFilter = array_get($this->getColumnFilters()->all(), $index); |
260 | 260 | |
261 | - if (! is_null($columnFilter) && ! is_null($column)) { |
|
261 | + if (!is_null($columnFilter) && !is_null($column)) { |
|
262 | 262 | $columnFilter->apply($this->repository, $column, $query, $search, $fullSearch); |
263 | 263 | } |
264 | 264 | } |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | { |
278 | 278 | $columns = $this->getColumns(); |
279 | 279 | |
280 | - $result = []; |
|
281 | - $result['draw'] = Request::input('draw', 0); |
|
282 | - $result['recordsTotal'] = $totalCount; |
|
283 | - $result['recordsFiltered'] = $filteredCount; |
|
284 | - $result['data'] = []; |
|
280 | + $result = [ ]; |
|
281 | + $result[ 'draw' ] = Request::input('draw', 0); |
|
282 | + $result[ 'recordsTotal' ] = $totalCount; |
|
283 | + $result[ 'recordsFiltered' ] = $filteredCount; |
|
284 | + $result[ 'data' ] = [ ]; |
|
285 | 285 | |
286 | 286 | foreach ($collection as $instance) { |
287 | - $_row = []; |
|
287 | + $_row = [ ]; |
|
288 | 288 | |
289 | 289 | foreach ($columns->all() as $column) { |
290 | 290 | $column->setModel($instance); |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | $column->initialize(); |
294 | 294 | } |
295 | 295 | |
296 | - $_row[] = (string) $column; |
|
296 | + $_row[ ] = (string) $column; |
|
297 | 297 | } |
298 | 298 | |
299 | - $result['data'][] = $_row; |
|
299 | + $result[ 'data' ][ ] = $_row; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | return $result; |
@@ -87,7 +87,7 @@ |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * @return int |
|
90 | + * @return string |
|
91 | 91 | */ |
92 | 92 | public function getWidth() |
93 | 93 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | $this->header = app(TableHeaderColumnInterface::class); |
65 | 65 | |
66 | - if (! is_null($label)) { |
|
66 | + if (!is_null($label)) { |
|
67 | 67 | $this->setLabel($label); |
68 | 68 | } |
69 | 69 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $this->model = $model; |
170 | 170 | $append = $this->getAppends(); |
171 | 171 | |
172 | - if (! is_null($append)) { |
|
172 | + if (!is_null($append)) { |
|
173 | 173 | $append->setModel($model); |
174 | 174 | } |
175 | 175 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $orderable = new OrderByClause($orderable); |
211 | 211 | } |
212 | 212 | |
213 | - if ($orderable !== false && ! $orderable instanceof OrderByClauseInterface) { |
|
213 | + if ($orderable !== false && !$orderable instanceof OrderByClauseInterface) { |
|
214 | 214 | throw new \InvalidArgumentException('Argument must be instance of SleepingOwl\Admin\Contracts\Display\OrderByClauseInterface interface'); |
215 | 215 | } |
216 | 216 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function orderBy(Builder $query, $condition) |
237 | 237 | { |
238 | - if (! $this->isOrderable()) { |
|
238 | + if (!$this->isOrderable()) { |
|
239 | 239 | throw new \InvalidArgumentException('Argument must be instance of SleepingOwl\Admin\Contracts\Display\OrderByClauseInterface interface'); |
240 | 240 | } |
241 | 241 |
@@ -145,7 +145,7 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * @return string |
|
148 | + * @return \Illuminate\Support\Collection |
|
149 | 149 | */ |
150 | 150 | public function getRedirect() |
151 | 151 | { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @var array |
71 | 71 | */ |
72 | - protected $redirect = ['edit' => 'edit', 'create' => 'edit']; |
|
72 | + protected $redirect = [ 'edit' => 'edit', 'create' => 'edit' ]; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @var Closure|null |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public function isCreatable() |
370 | 370 | { |
371 | - if (! is_callable($this->getCreate())) { |
|
371 | + if (!is_callable($this->getCreate())) { |
|
372 | 372 | return false; |
373 | 373 | } |
374 | 374 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | public function isEditable(Model $model) |
394 | 394 | { |
395 | - if (! is_callable($this->getEdit())) { |
|
395 | + if (!is_callable($this->getEdit())) { |
|
396 | 396 | return false; |
397 | 397 | } |
398 | 398 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function fireDisplay() |
504 | 504 | { |
505 | - if (! is_callable($this->display)) { |
|
505 | + if (!is_callable($this->display)) { |
|
506 | 506 | return; |
507 | 507 | } |
508 | 508 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public function fireCreate() |
522 | 522 | { |
523 | - if (! is_callable($this->create)) { |
|
523 | + if (!is_callable($this->create)) { |
|
524 | 524 | return; |
525 | 525 | } |
526 | 526 | |
@@ -547,11 +547,11 @@ discard block |
||
547 | 547 | */ |
548 | 548 | public function fireEdit($id) |
549 | 549 | { |
550 | - if (! is_callable($this->edit)) { |
|
550 | + if (!is_callable($this->edit)) { |
|
551 | 551 | return; |
552 | 552 | } |
553 | 553 | |
554 | - $form = app()->call($this->edit, ['id' => $id]); |
|
554 | + $form = app()->call($this->edit, [ 'id' => $id ]); |
|
555 | 555 | if ($form instanceof DisplayInterface) { |
556 | 556 | $form->setModelClass($this->getClass()); |
557 | 557 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | public function fireDelete($id) |
577 | 577 | { |
578 | 578 | if (is_callable($this->getDelete())) { |
579 | - return app()->call($this->getDelete(), [$id]); |
|
579 | + return app()->call($this->getDelete(), [ $id ]); |
|
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | public function fireDestroy($id) |
589 | 589 | { |
590 | 590 | if (is_callable($this->getDestroy())) { |
591 | - return app()->call($this->getDestroy(), [$id]); |
|
591 | + return app()->call($this->getDestroy(), [ $id ]); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | public function fireRestore($id) |
601 | 601 | { |
602 | 602 | if (is_callable($this->getRestore())) { |
603 | - return app()->call($this->getRestore(), [$id]); |
|
603 | + return app()->call($this->getRestore(), [ $id ]); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | return $this->getRestore(); |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | $repository = $this->getRepository(); |
745 | 745 | $item = $repository->find($id); |
746 | 746 | |
747 | - if (is_null($item) || ! $this->isEditable($item)) { |
|
747 | + if (is_null($item) || !$this->isEditable($item)) { |
|
748 | 748 | abort(404); |
749 | 749 | } |
750 | 750 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | - * @return string |
|
27 | + * @return \Illuminate\Support\Collection |
|
28 | 28 | */ |
29 | 29 | public function getRedirect() |
30 | 30 | { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * @var array |
14 | 14 | */ |
15 | - protected $redirect = ['edit' => 'edit', 'create' => 'edit']; |
|
15 | + protected $redirect = [ 'edit' => 'edit', 'create' => 'edit' ]; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @param string $redirect |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function fireDisplay() |
56 | 56 | { |
57 | - if (! method_exists($this, 'onDisplay')) { |
|
57 | + if (!method_exists($this, 'onDisplay')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - $display = app()->call([$this, 'onDisplay']); |
|
61 | + $display = app()->call([ $this, 'onDisplay' ]); |
|
62 | 62 | |
63 | 63 | if ($display instanceof DisplayInterface) { |
64 | 64 | $display->setModelClass($this->getClass()); |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function fireCreate() |
75 | 75 | { |
76 | - if (! method_exists($this, 'onCreate')) { |
|
76 | + if (!method_exists($this, 'onCreate')) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | |
80 | - $form = app()->call([$this, 'onCreate']); |
|
80 | + $form = app()->call([ $this, 'onCreate' ]); |
|
81 | 81 | if ($form instanceof DisplayInterface) { |
82 | 82 | $form->setModelClass($this->getClass()); |
83 | 83 | } |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function fireEdit($id) |
102 | 102 | { |
103 | - if (! method_exists($this, 'onEdit')) { |
|
103 | + if (!method_exists($this, 'onEdit')) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
107 | - $form = app()->call([$this, 'onEdit'], ['id' => $id]); |
|
107 | + $form = app()->call([ $this, 'onEdit' ], [ 'id' => $id ]); |
|
108 | 108 | if ($form instanceof DisplayInterface) { |
109 | 109 | $form->setModelClass($this->getClass()); |
110 | 110 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function fireDelete($id) |
130 | 130 | { |
131 | 131 | if (method_exists($this, 'onDelete')) { |
132 | - return app()->call([$this, 'onDelete'], ['id' => $id]); |
|
132 | + return app()->call([ $this, 'onDelete' ], [ 'id' => $id ]); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function fireDestroy($id) |
142 | 142 | { |
143 | 143 | if (method_exists($this, 'onDestroy')) { |
144 | - return app()->call([$this, 'onDestroy'], ['id' => $id]); |
|
144 | + return app()->call([ $this, 'onDestroy' ], [ 'id' => $id ]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function fireRestore($id) |
154 | 154 | { |
155 | 155 | if (method_exists($this, 'onRestore')) { |
156 | - return app()->call([$this, 'onRestore'], ['id' => $id]); |
|
156 | + return app()->call([ $this, 'onRestore' ], [ 'id' => $id ]); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
@@ -95,7 +95,7 @@ |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | - * @param $widget |
|
98 | + * @param string $widget |
|
99 | 99 | * |
100 | 100 | * @return \Closure |
101 | 101 | */ |
@@ -54,22 +54,22 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | $groupedBlocks = $this->widgets |
57 | - ->map(function ($class) { |
|
57 | + ->map(function($class) { |
|
58 | 58 | return $this->makeWidget($class); |
59 | 59 | }) |
60 | - ->filter(function (WidgetInterface $block) { |
|
60 | + ->filter(function(WidgetInterface $block) { |
|
61 | 61 | return $block->active(); |
62 | 62 | }) |
63 | - ->groupBy(function (WidgetInterface $block) { |
|
63 | + ->groupBy(function(WidgetInterface $block) { |
|
64 | 64 | return $block->template(); |
65 | 65 | }); |
66 | 66 | |
67 | 67 | foreach ($groupedBlocks as $template => $widgets) { |
68 | - $factory->composer($template, function (View $view) use ($widgets) { |
|
68 | + $factory->composer($template, function(View $view) use ($widgets) { |
|
69 | 69 | $factory = $view->getFactory(); |
70 | 70 | |
71 | 71 | /** @var Collection|WidgetInterface[] $widgets */ |
72 | - $widgets = $widgets->sortBy(function (WidgetInterface $block) { |
|
72 | + $widgets = $widgets->sortBy(function(WidgetInterface $block) { |
|
73 | 73 | return $block->position(); |
74 | 74 | }); |
75 | 75 |