@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @param $id |
205 | 205 | * @param $parentId |
206 | - * @param $left |
|
206 | + * @param integer $left |
|
207 | 207 | * @param $right |
208 | 208 | */ |
209 | 209 | protected function move($id, $parentId, $left, $right) |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * Call several methods and get first result. |
301 | 301 | * |
302 | 302 | * @param $instance |
303 | - * @param $methods |
|
303 | + * @param string[] $methods |
|
304 | 304 | * |
305 | 305 | * @return mixed |
306 | 306 | * @throws Exception |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @param $root |
322 | 322 | * @param $parentId |
323 | - * @param $left |
|
323 | + * @param integer $left |
|
324 | 324 | * |
325 | - * @return mixed |
|
325 | + * @return integer |
|
326 | 326 | */ |
327 | 327 | protected function recursiveReorder($root, $parentId, $left) |
328 | 328 | { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * Recursive reoder simple tree type. |
342 | 342 | * |
343 | 343 | * @param $data |
344 | - * @param $parentId |
|
344 | + * @param string|null $parentId |
|
345 | 345 | */ |
346 | 346 | protected function recursiveReorderSimple(array $data, $parentId) |
347 | 347 | { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * Get children for simple tree type structure. |
364 | 364 | * |
365 | 365 | * @param $collection |
366 | - * @param $id |
|
366 | + * @param string|null $id |
|
367 | 367 | * |
368 | 368 | * @return Collection |
369 | 369 | */ |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Create simple tree type structure. |
388 | - * @return static |
|
388 | + * @return Collection |
|
389 | 389 | */ |
390 | 390 | protected function createSimpleTree() |
391 | 391 | { |
@@ -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 { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct(Closure $callback = null) |
26 | 26 | { |
27 | - if (! is_null($callback)) { |
|
27 | + if (!is_null($callback)) { |
|
28 | 28 | $this->setCallback($callback); |
29 | 29 | } |
30 | 30 |
@@ -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 |
@@ -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 | * |
@@ -4,16 +4,13 @@ |
||
4 | 4 | |
5 | 5 | use Request; |
6 | 6 | use Illuminate\Routing\Router; |
7 | -use Illuminate\Http\JsonResponse; |
|
8 | 7 | use Illuminate\Support\Collection; |
9 | 8 | use Illuminate\Database\Eloquent\Builder; |
10 | 9 | use SleepingOwl\Admin\Display\Column\Link; |
11 | 10 | use SleepingOwl\Admin\Display\Column\Text; |
12 | 11 | use SleepingOwl\Admin\Display\Column\Email; |
13 | 12 | use SleepingOwl\Admin\Display\Column\Control; |
14 | -use Illuminate\Contracts\Foundation\Application; |
|
15 | 13 | use SleepingOwl\Admin\Contracts\WithRoutesInterface; |
16 | -use SleepingOwl\Admin\Contracts\ModelConfigurationInterface; |
|
17 | 14 | |
18 | 15 | class DisplayDatatablesAsync extends DisplayDatatables implements WithRoutesInterface |
19 | 16 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public static function registerRoutes(Router $router) |
28 | 28 | { |
29 | 29 | $routeName = 'admin.display.async'; |
30 | - if (! $router->has($routeName)) { |
|
30 | + if (!$router->has($routeName)) { |
|
31 | 31 | $router->get('{adminModel}/async/{adminDisplayName?}', [ |
32 | 32 | 'as' => $routeName, |
33 | 33 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@async' |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | $routeName = 'admin.display.async.inlineEdit'; |
38 | - if (! $router->has($routeName)) { |
|
38 | + if (!$router->has($routeName)) { |
|
39 | 39 | $router->post('{adminModel}/async/{adminDisplayName?}', [ |
40 | 40 | 'as' => $routeName, |
41 | 41 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\AdminController@inlineEdit' |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $totalCount = $query->count(); |
146 | 146 | $filteredCount = 0; |
147 | 147 | |
148 | - if (! is_null($this->distinct)) { |
|
148 | + if (!is_null($this->distinct)) { |
|
149 | 149 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
150 | 150 | } |
151 | 151 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | - $query->where(function ($query) use ($search) { |
|
196 | + $query->where(function($query) use ($search) { |
|
197 | 197 | $columns = $this->getColumns()->all(); |
198 | 198 | foreach ($columns as $column) { |
199 | 199 | if (in_array(get_class($column), $this->searchableColumns)) { |
@@ -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 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function getDefaultFrom() |
29 | 29 | { |
30 | - if (! $this->defaultFrom) { |
|
30 | + if (!$this->defaultFrom) { |
|
31 | 31 | $this->defaultFrom = Carbon::now(); |
32 | 32 | } |
33 | 33 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getDefaultTo() |
55 | 55 | { |
56 | - if (! $this->defaultTo) { |
|
56 | + if (!$this->defaultTo) { |
|
57 | 57 | $this->defaultTo = Carbon::now(); |
58 | 58 | } |
59 | 59 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setValue(Model $model, $attribute, $value) |
83 | 83 | { |
84 | - $value = ! empty($value) ? array_map(function ($date) { |
|
84 | + $value = !empty($value) ? array_map(function($date) { |
|
85 | 85 | return Carbon::createFromFormat($this->getPickerFormat(), $date); |
86 | 86 | }, explode('::', $value)) : null; |
87 | 87 |
@@ -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 | } |