@@ -308,7 +308,7 @@ |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * @return \Illuminate\Foundation\Application|mixed |
|
311 | + * @return RepositoryInterface |
|
312 | 312 | * @throws \Exception |
313 | 313 | */ |
314 | 314 | protected function makeRepository() |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $this->title, |
191 | 191 | ]; |
192 | 192 | |
193 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
193 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
194 | 194 | if (method_exists($extension, $method = 'getTitle')) { |
195 | 195 | $titles[] = call_user_func([$extension, $method]); |
196 | 196 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | foreach ($blocks as $block => $data) { |
240 | 240 | foreach ($data as $html) { |
241 | - if (! empty($html)) { |
|
241 | + if (!empty($html)) { |
|
242 | 242 | $view->getFactory()->startSection($block); |
243 | 243 | echo $html; |
244 | 244 | $view->getFactory()->yieldSection(); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | protected function makeRepository() |
288 | 288 | { |
289 | 289 | $repository = app($this->repositoryClass); |
290 | - if (! ($repository instanceof RepositoryInterface)) { |
|
290 | + if (!($repository instanceof RepositoryInterface)) { |
|
291 | 291 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
292 | 292 | } |
293 | 293 |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
292 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
293 | 293 | */ |
294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
295 | 295 | { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
302 | - * @return \Illuminate\Foundation\Application|mixed |
|
302 | + * @return TreeRepositoryInterface |
|
303 | 303 | * @throws \Exception |
304 | 304 | */ |
305 | 305 | protected function makeRepository() |
@@ -106,9 +106,9 @@ |
||
106 | 106 | parent::initialize(); |
107 | 107 | |
108 | 108 | $repository = $this->getRepository() |
109 | - ->setParentField($this->getParentField()) |
|
110 | - ->setOrderField($this->getOrderField()) |
|
111 | - ->setRootParentId($this->getRootParentId()); |
|
109 | + ->setParentField($this->getParentField()) |
|
110 | + ->setOrderField($this->getOrderField()) |
|
111 | + ->setRootParentId($this->getRootParentId()); |
|
112 | 112 | |
113 | 113 | if (! is_null($this->treeType)) { |
114 | 114 | $repository->setTreeType($this->treeType); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public static function registerRoutes(Router $router) |
23 | 23 | { |
24 | 24 | $routeName = 'admin.display.tree.reorder'; |
25 | - if (! $router->has($routeName)) { |
|
25 | + if (!$router->has($routeName)) { |
|
26 | 26 | $router->post('{adminModel}/reorder', ['as' => $routeName, 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@treeReorder']); |
27 | 27 | } |
28 | 28 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ->setOrderField($this->getOrderField()) |
111 | 111 | ->setRootParentId($this->getRootParentId()); |
112 | 112 | |
113 | - if (! is_null($this->treeType)) { |
|
113 | + if (!is_null($this->treeType)) { |
|
114 | 114 | $repository->setTreeType($this->treeType); |
115 | 115 | } |
116 | 116 | } |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function getCollection() |
307 | 307 | { |
308 | - if (! $this->isInitialized()) { |
|
308 | + if (!$this->isInitialized()) { |
|
309 | 309 | throw new \Exception('Display is not initialized'); |
310 | 310 | } |
311 | 311 | |
312 | - if (! is_null($this->collection)) { |
|
312 | + if (!is_null($this->collection)) { |
|
313 | 313 | return $this->collection; |
314 | 314 | } |
315 | 315 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | { |
341 | 341 | $repository = parent::makeRepository(); |
342 | 342 | |
343 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
343 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
344 | 344 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
345 | 345 | } |
346 | 346 |
@@ -290,7 +290,7 @@ |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
293 | - * @return null|string |
|
293 | + * @return boolean |
|
294 | 294 | */ |
295 | 295 | public function hasCustomControllerClass() |
296 | 296 | { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $this->repository = $app->make(RepositoryInterface::class); |
116 | 116 | $this->repository->setClass($class); |
117 | - if (! $this->alias) { |
|
117 | + if (!$this->alias) { |
|
118 | 118 | $this->setDefaultAlias(); |
119 | 119 | } |
120 | 120 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function can($action, Model $model) |
305 | 305 | { |
306 | - if (! $this->checkAccess) { |
|
306 | + if (!$this->checkAccess) { |
|
307 | 307 | return true; |
308 | 308 | } |
309 | 309 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function hasCustomControllerClass() |
337 | 337 | { |
338 | - return ! is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
338 | + return !is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $page->setPriority($priority); |
473 | 473 | |
474 | 474 | if ($badge) { |
475 | - if (! ($badge instanceof BadgeInterface)) { |
|
475 | + if (!($badge instanceof BadgeInterface)) { |
|
476 | 476 | $badge = new Badge($badge); |
477 | 477 | } |
478 | 478 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | public function fireEvent($event, $halt = true, Model $model = null, ...$payload) |
517 | 517 | { |
518 | - if (! isset(self::$dispatcher)) { |
|
518 | + if (!isset(self::$dispatcher)) { |
|
519 | 519 | return true; |
520 | 520 | } |
521 | 521 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * @return Closure |
|
86 | + * @return \Closure |
|
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getModelConfiguration() |
33 | 33 | { |
34 | - if (! $this->hasModel()) { |
|
34 | + if (!$this->hasModel()) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function hasModel() |
45 | 45 | { |
46 | - return ! is_null($this->model) and class_exists($this->model); |
|
46 | + return !is_null($this->model) and class_exists($this->model); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
90 | - if (! is_callable($this->accessLogic)) { |
|
90 | + if (!is_callable($this->accessLogic)) { |
|
91 | 91 | if ($this->hasModel()) { |
92 | - return function () { |
|
92 | + return function() { |
|
93 | 93 | return $this->getModelConfiguration()->isDisplayable(); |
94 | 94 | }; |
95 | 95 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $data = $this->toArray(); |
109 | 109 | |
110 | - if (! is_null($view)) { |
|
110 | + if (!is_null($view)) { |
|
111 | 111 | return view($view, $data)->render(); |
112 | 112 | } |
113 | 113 |
@@ -38,8 +38,8 @@ |
||
38 | 38 | $relationName = implode('.', $parts); |
39 | 39 | } |
40 | 40 | |
41 | - if (! is_null($relationName)) { |
|
42 | - $query->whereHas($relationName, function ($q) use ($name, $value) { |
|
41 | + if (!is_null($relationName)) { |
|
42 | + $query->whereHas($relationName, function($q) use ($name, $value) { |
|
43 | 43 | $this->buildQuery($q, $name, $value); |
44 | 44 | }); |
45 | 45 | } else { |
@@ -313,11 +313,11 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function isShowDeleteButton() |
315 | 315 | { |
316 | - if (is_null($this->getModel()->getKey()) || ! $this->showDeleteButton) { |
|
316 | + if (is_null($this->getModel()->getKey()) || !$this->showDeleteButton) { |
|
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | - $this->showDeleteButton = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
320 | + $this->showDeleteButton = !$this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
321 | 321 | |
322 | 322 | return $this->showDeleteButton; |
323 | 323 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function isShowDestroyButton() |
339 | 339 | { |
340 | - if (is_null($this->getModel()->getKey()) || ! $this->showDestroyButton) { |
|
340 | + if (is_null($this->getModel()->getKey()) || !$this->showDestroyButton) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function isShowRestoreButton() |
364 | 364 | { |
365 | - if (is_null($this->getModel()->getKey()) || ! $this->showRestoreButton) { |
|
365 | + if (is_null($this->getModel()->getKey()) || !$this->showRestoreButton) { |
|
366 | 366 | return false; |
367 | 367 | } |
368 | 368 |
@@ -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 | { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->header = app(TableHeaderColumnInterface::class); |
66 | 66 | |
67 | - if (! is_null($label)) { |
|
67 | + if (!is_null($label)) { |
|
68 | 68 | $this->setLabel($label); |
69 | 69 | } |
70 | 70 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $orderable = new OrderByClause($orderable); |
207 | 207 | } |
208 | 208 | |
209 | - if ($orderable !== false && ! $orderable instanceof OrderByClauseInterface) { |
|
209 | + if ($orderable !== false && !$orderable instanceof OrderByClauseInterface) { |
|
210 | 210 | throw new \InvalidArgumentException('Argument must be instance of SleepingOwl\Admin\Contracts\Display\OrderByClauseInterface interface'); |
211 | 211 | } |
212 | 212 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function orderBy(Builder $query, $direction) |
235 | 235 | { |
236 | - if (! $this->isOrderable()) { |
|
236 | + if (!$this->isOrderable()) { |
|
237 | 237 | throw new \InvalidArgumentException('Argument must be instance of SleepingOwl\Admin\Contracts\Display\OrderByClauseInterface interface'); |
238 | 238 | } |
239 | 239 |
@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function set($filters) |
42 | 42 | { |
43 | - if (! is_array($filters)) { |
|
43 | + if (!is_array($filters)) { |
|
44 | 44 | $filters = func_get_args(); |
45 | 45 | } |
46 | 46 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getActive() |
80 | 80 | { |
81 | - return $this->filters->filter(function (FilterInterface $filter) { |
|
81 | + return $this->filters->filter(function(FilterInterface $filter) { |
|
82 | 82 | return $filter->isActive(); |
83 | 83 | }); |
84 | 84 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
126 | 126 | { |
127 | - $this->getActive()->each(function (FilterInterface $filter) use ($query) { |
|
127 | + $this->getActive()->each(function(FilterInterface $filter) use ($query) { |
|
128 | 128 | $filter->apply($query); |
129 | 129 | }); |
130 | 130 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function initialize() |
136 | 136 | { |
137 | - $this->filters->each(function (FilterInterface $filter) { |
|
137 | + $this->filters->each(function(FilterInterface $filter) { |
|
138 | 138 | $filter->initialize(); |
139 | 139 | }); |
140 | 140 | } |