@@ -207,7 +207,7 @@ |
||
207 | 207 | * @deprecated 4.5.0 |
208 | 208 | * @see getElements() |
209 | 209 | * |
210 | - * @return Collection[] |
|
210 | + * @return Collection |
|
211 | 211 | */ |
212 | 212 | public function getItems() |
213 | 213 | { |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $this->initialized = true; |
92 | - $this->repository = app(RepositoryInterface::class, [$this->class]); |
|
92 | + $this->repository = app(RepositoryInterface::class, [ $this->class ]); |
|
93 | 93 | |
94 | 94 | $this->setModel(app($this->class)); |
95 | 95 | |
96 | 96 | parent::initialize(); |
97 | 97 | |
98 | - $this->getElements()->each(function ($element) { |
|
99 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
98 | + $this->getElements()->each(function($element) { |
|
99 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
100 | 100 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
101 | 101 | } |
102 | 102 | }); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function setItems($items) |
226 | 226 | { |
227 | - if (! is_array($items)) { |
|
227 | + if (!is_array($items)) { |
|
228 | 228 | $items = func_get_args(); |
229 | 229 | } |
230 | 230 |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
282 | - * @return null|string |
|
282 | + * @return boolean |
|
283 | 283 | */ |
284 | 284 | public function hasCustomControllerClass() |
285 | 285 | { |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * @param string|int $id |
|
332 | + * @param integer $id |
|
333 | 333 | * |
334 | 334 | * @return string |
335 | 335 | */ |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | $this->class = $class; |
104 | 104 | $this->model = app($class); |
105 | 105 | |
106 | - $this->repository = app(RepositoryInterface::class, [$class]); |
|
106 | + $this->repository = app(RepositoryInterface::class, [ $class ]); |
|
107 | 107 | |
108 | - if (! $this->alias) { |
|
108 | + if (!$this->alias) { |
|
109 | 109 | $this->setDefaultAlias(); |
110 | 110 | } |
111 | 111 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getCreateTitle() |
182 | 182 | { |
183 | - return trans('sleeping_owl::lang.model.create', ['title' => $this->getTitle()]); |
|
183 | + return trans('sleeping_owl::lang.model.create', [ 'title' => $this->getTitle() ]); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function getEditTitle() |
190 | 190 | { |
191 | - return trans('sleeping_owl::lang.model.edit', ['title' => $this->getTitle()]); |
|
191 | + return trans('sleeping_owl::lang.model.edit', [ 'title' => $this->getTitle() ]); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function can($action, Model $model) |
265 | 265 | { |
266 | - if (! $this->checkAccess) { |
|
266 | + if (!$this->checkAccess) { |
|
267 | 267 | return true; |
268 | 268 | } |
269 | 269 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function hasCustomControllerClass() |
285 | 285 | { |
286 | - return ! is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
286 | + return !is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @return string |
293 | 293 | */ |
294 | - public function getDisplayUrl(array $parameters = []) |
|
294 | + public function getDisplayUrl(array $parameters = [ ]) |
|
295 | 295 | { |
296 | 296 | array_unshift($parameters, $this->getAlias()); |
297 | 297 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @return string |
305 | 305 | */ |
306 | - public function getCreateUrl(array $parameters = []) |
|
306 | + public function getCreateUrl(array $parameters = [ ]) |
|
307 | 307 | { |
308 | 308 | array_unshift($parameters, $this->getAlias()); |
309 | 309 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getEditUrl($id) |
327 | 327 | { |
328 | - return route('admin.model.edit', [$this->getAlias(), $id]); |
|
328 | + return route('admin.model.edit', [ $this->getAlias(), $id ]); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function getUpdateUrl($id) |
337 | 337 | { |
338 | - return route('admin.model.update', [$this->getAlias(), $id]); |
|
338 | + return route('admin.model.update', [ $this->getAlias(), $id ]); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function getDeleteUrl($id) |
347 | 347 | { |
348 | - return route('admin.model.delete', [$this->getAlias(), $id]); |
|
348 | + return route('admin.model.delete', [ $this->getAlias(), $id ]); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function getDestroyUrl($id) |
357 | 357 | { |
358 | - return route('admin.model.destroy', [$this->getAlias(), $id]); |
|
358 | + return route('admin.model.destroy', [ $this->getAlias(), $id ]); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function getRestoreUrl($id) |
367 | 367 | { |
368 | - return route('admin.model.restore', [$this->getAlias(), $id]); |
|
368 | + return route('admin.model.restore', [ $this->getAlias(), $id ]); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $page->setPriority($priority); |
421 | 421 | |
422 | 422 | if ($badge) { |
423 | - if (! ($badge instanceof BadgeInterface)) { |
|
423 | + if (!($badge instanceof BadgeInterface)) { |
|
424 | 424 | $badge = new Badge($badge); |
425 | 425 | } |
426 | 426 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function fireEvent($event, $halt = true, Model $model = null) |
445 | 445 | { |
446 | - if (! isset(self::$dispatcher)) { |
|
446 | + if (!isset(self::$dispatcher)) { |
|
447 | 447 | return true; |
448 | 448 | } |
449 | 449 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | $method = $halt ? 'until' : 'fire'; |
460 | 460 | |
461 | - return self::$dispatcher->$method($event, [$this, $model]); |
|
461 | + return self::$dispatcher->$method($event, [ $this, $model ]); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ])) { |
478 | 478 | array_unshift($arguments, $method); |
479 | 479 | |
480 | - return call_user_func_array([$this, 'registerEvent'], $arguments); |
|
480 | + return call_user_func_array([ $this, 'registerEvent' ], $arguments); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | throw new BadMethodCallException($method); |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param $id |
|
71 | + * @param integer $id |
|
72 | 72 | * |
73 | 73 | * @return mixed|void |
74 | 74 | */ |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function fireDisplay() |
33 | 33 | { |
34 | - if (! method_exists($this, 'onDisplay')) { |
|
34 | + if (!method_exists($this, 'onDisplay')) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | - $display = app()->call([$this, 'onDisplay']); |
|
38 | + $display = app()->call([ $this, 'onDisplay' ]); |
|
39 | 39 | |
40 | 40 | if ($display instanceof DisplayInterface) { |
41 | 41 | $display->setModelClass($this->getClass()); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function fireCreate() |
52 | 52 | { |
53 | - if (! method_exists($this, 'onCreate')) { |
|
53 | + if (!method_exists($this, 'onCreate')) { |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - $create = app()->call([$this, 'onCreate']); |
|
57 | + $create = app()->call([ $this, 'onCreate' ]); |
|
58 | 58 | if ($create instanceof DisplayInterface) { |
59 | 59 | $create->setModelClass($this->getClass()); |
60 | 60 | $create->initialize(); |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function fireEdit($id) |
76 | 76 | { |
77 | - if (! method_exists($this, 'onEdit')) { |
|
77 | + if (!method_exists($this, 'onEdit')) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - $edit = app()->call([$this, 'onEdit'], ['id' => $id]); |
|
81 | + $edit = app()->call([ $this, 'onEdit' ], [ 'id' => $id ]); |
|
82 | 82 | if ($edit instanceof DisplayInterface) { |
83 | 83 | $edit->setModelClass($this->getClass()); |
84 | 84 | $edit->initialize(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function fireDelete($id) |
113 | 113 | { |
114 | 114 | if (method_exists($this, 'onDelete')) { |
115 | - return app()->call([$this, 'onDelete'], ['id' => $id]); |
|
115 | + return app()->call([ $this, 'onDelete' ], [ 'id' => $id ]); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function fireDestroy($id) |
125 | 125 | { |
126 | 126 | if (method_exists($this, 'onDestroy')) { |
127 | - return app()->call([$this, 'onDestroy'], ['id' => $id]); |
|
127 | + return app()->call([ $this, 'onDestroy' ], [ 'id' => $id ]); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function fireRestore($id) |
137 | 137 | { |
138 | 138 | if (method_exists($this, 'onRestore')) { |
139 | - return app()->call([$this, 'onRestore'], ['id' => $id]); |
|
139 | + return app()->call([ $this, 'onRestore' ], [ 'id' => $id ]); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @return \string[] |
|
63 | + * @return string[] |
|
64 | 64 | */ |
65 | 65 | public function getWith() |
66 | 66 | { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Get base query. |
84 | - * @return mixed |
|
84 | + * @return \Illuminate\Database\Eloquent\Builder |
|
85 | 85 | */ |
86 | 86 | public function getQuery() |
87 | 87 | { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Eager loading relations. |
26 | 26 | * @var string[] |
27 | 27 | */ |
28 | - protected $with = []; |
|
28 | + protected $with = [ ]; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param string $class |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function with($with) |
74 | 74 | { |
75 | - if (! is_array($with)) { |
|
75 | + if (!is_array($with)) { |
|
76 | 76 | $with = func_get_args(); |
77 | 77 | } |
78 | 78 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function hasColumn($column) |
179 | 179 | { |
180 | 180 | $table = $this->getModel()->getTable(); |
181 | - $columns = Cache::remember('admin.columns.'.$table, 60, function () use ($table) { |
|
181 | + $columns = Cache::remember('admin.columns.'.$table, 60, function() use ($table) { |
|
182 | 182 | return Schema::getColumnListing($table); |
183 | 183 | }); |
184 | 184 |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @param $id |
204 | 204 | * @param $parentId |
205 | - * @param $left |
|
205 | + * @param integer $left |
|
206 | 206 | * @param $right |
207 | 207 | */ |
208 | 208 | public function move($id, $parentId, $left, $right) |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * Call several methods and get first result. |
292 | 292 | * |
293 | 293 | * @param $instance |
294 | - * @param $methods |
|
294 | + * @param string[] $methods |
|
295 | 295 | * |
296 | 296 | * @return mixed |
297 | 297 | * @throws Exception |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @param $root |
313 | 313 | * @param $parentId |
314 | - * @param $left |
|
314 | + * @param integer $left |
|
315 | 315 | * |
316 | - * @return mixed |
|
316 | + * @return integer |
|
317 | 317 | */ |
318 | 318 | protected function recursiveReorder($root, $parentId, $left) |
319 | 319 | { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * Recursive reoder simple tree type. |
333 | 333 | * |
334 | 334 | * @param $data |
335 | - * @param $parentId |
|
335 | + * @param string|null $parentId |
|
336 | 336 | */ |
337 | 337 | protected function recursiveReorderSimple($data, $parentId) |
338 | 338 | { |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | * Get children for simple tree type structure. |
355 | 355 | * |
356 | 356 | * @param $collection |
357 | - * @param $id |
|
357 | + * @param string|null $id |
|
358 | 358 | * |
359 | - * @return static |
|
359 | + * @return Collection |
|
360 | 360 | */ |
361 | 361 | protected function getChildren($collection, $id) |
362 | 362 | { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | |
377 | 377 | /** |
378 | 378 | * Create simple tree type structure. |
379 | - * @return static |
|
379 | + * @return Collection |
|
380 | 380 | */ |
381 | 381 | protected function createSimpleTree() |
382 | 382 | { |
@@ -381,9 +381,9 @@ |
||
381 | 381 | protected function createSimpleTree() |
382 | 382 | { |
383 | 383 | $collection = $this->getQuery() |
384 | - ->orderBy($this->getParentField(), 'asc') |
|
385 | - ->orderBy($this->getOrderField(), 'asc') |
|
386 | - ->get(); |
|
384 | + ->orderBy($this->getParentField(), 'asc') |
|
385 | + ->orderBy($this->getOrderField(), 'asc') |
|
386 | + ->get(); |
|
387 | 387 | |
388 | 388 | $parent = $this->getRootParentId(); |
389 | 389 |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | { |
210 | 210 | $instance = $this->find($id); |
211 | 211 | $attributes = $instance->getAttributes(); |
212 | - $attributes[$this->getLeftColumn($instance)] = $left; |
|
213 | - $attributes[$this->getRightColumn($instance)] = $right; |
|
214 | - $attributes[$this->getParentColumn($instance)] = $parentId; |
|
212 | + $attributes[ $this->getLeftColumn($instance) ] = $left; |
|
213 | + $attributes[ $this->getRightColumn($instance) ] = $right; |
|
214 | + $attributes[ $this->getParentColumn($instance) ] = $parentId; |
|
215 | 215 | $instance->setRawAttributes($attributes); |
216 | 216 | $instance->save(); |
217 | 217 | } |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | protected function recursiveReorder($root, $parentId, $left) |
319 | 319 | { |
320 | 320 | $right = $left + 1; |
321 | - $children = array_get($root, 'children', []); |
|
321 | + $children = array_get($root, 'children', [ ]); |
|
322 | 322 | foreach ($children as $child) { |
323 | - $right = $this->recursiveReorder($child, $root['id'], $right); |
|
323 | + $right = $this->recursiveReorder($child, $root[ 'id' ], $right); |
|
324 | 324 | } |
325 | - $this->move($root['id'], $parentId, $left, $right); |
|
325 | + $this->move($root[ 'id' ], $parentId, $left, $right); |
|
326 | 326 | $left = $right + 1; |
327 | 327 | |
328 | 328 | return $left; |
@@ -337,15 +337,15 @@ discard block |
||
337 | 337 | protected function recursiveReorderSimple($data, $parentId) |
338 | 338 | { |
339 | 339 | foreach ($data as $order => $item) { |
340 | - $id = $item['id']; |
|
340 | + $id = $item[ 'id' ]; |
|
341 | 341 | |
342 | 342 | $instance = $this->find($id); |
343 | 343 | $instance->{$this->getParentField()} = $parentId; |
344 | 344 | $instance->{$this->getOrderField()} = $order; |
345 | 345 | $instance->save(); |
346 | 346 | |
347 | - if (isset($item['children'])) { |
|
348 | - $this->recursiveReorderSimple($item['children'], $id); |
|
347 | + if (isset($item[ 'children' ])) { |
|
348 | + $this->recursiveReorderSimple($item[ 'children' ], $id); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | } |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | protected function getChildren($collection, $id) |
362 | 362 | { |
363 | 363 | $parentField = $this->getParentField(); |
364 | - $result = []; |
|
364 | + $result = [ ]; |
|
365 | 365 | foreach ($collection as $instance) { |
366 | 366 | if ($instance->$parentField != $id) { |
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
370 | 370 | $instance->setRelation('children', $this->getChildren($collection, $instance->getKey())); |
371 | - $result[] = $instance; |
|
371 | + $result[ ] = $instance; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | return Collection::make($result); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | /** |
47 | 47 | * Move model in the $destination. |
48 | 48 | * |
49 | - * @param $destination -1 (move down) or 1 (move up) |
|
49 | + * @param integer $destination -1 (move down) or 1 (move up) |
|
50 | 50 | */ |
51 | 51 | protected function move($destination) |
52 | 52 | { |
@@ -73,8 +73,8 @@ |
||
73 | 73 | protected function updateOrderFieldOnDelete() |
74 | 74 | { |
75 | 75 | static::orderModel() |
76 | - ->where($this->getOrderField(), '>', $this->getOrderValue()) |
|
77 | - ->decrement($this->getOrderField()); |
|
76 | + ->where($this->getOrderField(), '>', $this->getOrderValue()) |
|
77 | + ->decrement($this->getOrderField()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -9,11 +9,11 @@ |
||
9 | 9 | */ |
10 | 10 | protected static function bootOrderableModel() |
11 | 11 | { |
12 | - static::creating(function ($row) { |
|
12 | + static::creating(function($row) { |
|
13 | 13 | $row->updateOrderFieldOnCreate(); |
14 | 14 | }); |
15 | 15 | |
16 | - static::deleted(function ($row) { |
|
16 | + static::deleted(function($row) { |
|
17 | 17 | $row->updateOrderFieldOnDelete(); |
18 | 18 | }); |
19 | 19 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | /** |
81 | 81 | * @param string $editorId |
82 | 82 | * |
83 | - * @return bool |
|
83 | + * @return boolean|null |
|
84 | 84 | */ |
85 | 85 | public function loadEditor($editorId) |
86 | 86 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function register($editorId, WysiwygFilterInterface $filter = null, $name = null) |
45 | 45 | { |
46 | - $config = config('sleeping_owl.wysiwyg.'.$editorId, []); |
|
46 | + $config = config('sleeping_owl.wysiwyg.'.$editorId, [ ]); |
|
47 | 47 | |
48 | 48 | $this->getFilters()->push( |
49 | 49 | $editor = new Editor($editorId, $name, $filter, $config) |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getEditor($editorId) |
69 | 69 | { |
70 | - return $this->getFilters()->filter(function (WysiwygEditorInterface $editor) use ($editorId) { |
|
70 | + return $this->getFilters()->filter(function(WysiwygEditorInterface $editor) use ($editorId) { |
|
71 | 71 | return $editor->getId() == $editorId; |
72 | 72 | })->first(); |
73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function loadEditor($editorId) |
86 | 86 | { |
87 | - if (! is_null($editor = $this->getEditor($editorId))) { |
|
87 | + if (!is_null($editor = $this->getEditor($editorId))) { |
|
88 | 88 | if ($editor->isUsed()) { |
89 | 89 | return true; |
90 | 90 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function applyFilter($editorId, $text) |
106 | 106 | { |
107 | - if (! is_null($editor = $this->getEditor($editorId))) { |
|
107 | + if (!is_null($editor = $this->getEditor($editorId))) { |
|
108 | 108 | return $editor->applyFilter($text); |
109 | 109 | } |
110 | 110 |
@@ -87,6 +87,6 @@ |
||
87 | 87 | | |
88 | 88 | */ |
89 | 89 | |
90 | - 'attributes' => [], |
|
90 | + 'attributes' => [ ], |
|
91 | 91 | |
92 | 92 | ]; |
@@ -62,6 +62,6 @@ |
||
62 | 62 | | |
63 | 63 | */ |
64 | 64 | |
65 | - 'attributes' => [], |
|
65 | + 'attributes' => [ ], |
|
66 | 66 | |
67 | 67 | ]; |