@@ -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 |
@@ -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 | * |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $router->get('{adminModel}/async/{adminDisplayName?}', [ |
30 | 30 | 'as' => 'admin.model.async', |
31 | - function (ModelConfigurationInterface $model, $name = null) { |
|
31 | + function(ModelConfigurationInterface $model, $name = null) { |
|
32 | 32 | $display = $model->fireDisplay(); |
33 | 33 | if ($display instanceof DisplayTabbed) { |
34 | 34 | $display = static::findDatatablesAsyncByName($display, $name); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ]); |
44 | 44 | $router->post('{adminModel}/async/{adminDisplayName?}', [ |
45 | 45 | 'as' => 'admin.model.async.inline', |
46 | - function (ModelConfigurationInterface $model, InlineRequest $request) { |
|
46 | + function(ModelConfigurationInterface $model, InlineRequest $request) { |
|
47 | 47 | $field = $request->input('name'); |
48 | 48 | $value = $request->input('value'); |
49 | 49 | $id = $request->input('pk'); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $display = $model->fireDisplay(); |
52 | 52 | |
53 | 53 | /** @var ColumnEditableInterface|null $column */ |
54 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
54 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
55 | 55 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
56 | 56 | })->first(); |
57 | 57 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $totalCount = $query->count(); |
187 | 187 | $filteredCount = 0; |
188 | 188 | |
189 | - if (! is_null($this->distinct)) { |
|
189 | + if (!is_null($this->distinct)) { |
|
190 | 190 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
191 | 191 | } |
192 | 192 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
237 | - $query->where(function ($query) use ($search) { |
|
237 | + $query->where(function($query) use ($search) { |
|
238 | 238 | $columns = $this->getColumns()->all(); |
239 | 239 | foreach ($columns as $column) { |
240 | 240 | if (in_array(get_class($column), $this->searchableColumns)) { |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $column = $this->getColumns()->all()->get($index); |
261 | 261 | $columnFilter = array_get($this->getColumnFilters()->all(), $index); |
262 | 262 | |
263 | - if (! is_null($columnFilter) && ! is_null($column)) { |
|
263 | + if (!is_null($columnFilter) && !is_null($column)) { |
|
264 | 264 | $columnFilter->apply($this->repository, $column, $query, $search, $fullSearch); |
265 | 265 | } |
266 | 266 | } |
@@ -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 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function getValue() |
50 | 50 | { |
51 | 51 | $value = parent::getValue(); |
52 | - if (! empty($value)) { |
|
52 | + if (!empty($value)) { |
|
53 | 53 | return $this->parseValue($value); |
54 | 54 | } |
55 | 55 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setValue(Model $model, $attribute, $value) |
83 | 83 | { |
84 | - $value = ! empty($value) ? Carbon::createFromFormat($this->getPickerFormat(), $value)->format($this->getFormat()) : null; |
|
84 | + $value = !empty($value) ? Carbon::createFromFormat($this->getPickerFormat(), $value)->format($this->getFormat()) : null; |
|
85 | 85 | |
86 | 86 | parent::setValue($model, $attribute, $value); |
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 | } |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | { |
65 | 65 | parent::initialize(); |
66 | 66 | |
67 | - $this->buttons->put('edit', $button = new ControlLink(function (Model $model) { |
|
67 | + $this->buttons->put('edit', $button = new ControlLink(function(Model $model) { |
|
68 | 68 | return $this->getModelConfiguration()->getEditUrl($model->getKey()); |
69 | 69 | }, trans('sleeping_owl::lang.table.edit'), 100)); |
70 | 70 | $button->hideText(); |
71 | - $button->setCondition(function () { |
|
71 | + $button->setCondition(function() { |
|
72 | 72 | return $this->isEditable(); |
73 | 73 | }); |
74 | 74 | $button->setIcon('fa fa-pencil'); |
75 | 75 | $button->setHtmlAttribute('class', 'btn-primary'); |
76 | 76 | |
77 | - $this->buttons->put('delete', $button = new ControlButton(function (Model $model) { |
|
77 | + $this->buttons->put('delete', $button = new ControlButton(function(Model $model) { |
|
78 | 78 | return $this->getModelConfiguration()->getDeleteUrl($model->getKey()); |
79 | 79 | }, trans('sleeping_owl::lang.table.delete'), 200)); |
80 | - $button->setCondition(function () { |
|
80 | + $button->setCondition(function() { |
|
81 | 81 | return $this->isDeletable(); |
82 | 82 | }); |
83 | 83 | |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $button->setIcon('fa fa-trash'); |
87 | 87 | $button->setHtmlAttribute('class', 'btn-danger btn-delete'); |
88 | 88 | |
89 | - $this->buttons->put('destroy', $button = new ControlButton(function (Model $model) { |
|
89 | + $this->buttons->put('destroy', $button = new ControlButton(function(Model $model) { |
|
90 | 90 | return $this->getModelConfiguration()->getDestroyUrl($model->getKey()); |
91 | 91 | }, trans('sleeping_owl::lang.table.destroy'), 300)); |
92 | - $button->setCondition(function () { |
|
92 | + $button->setCondition(function() { |
|
93 | 93 | return $this->isDestroyable(); |
94 | 94 | }); |
95 | 95 | |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | $button->setIcon('fa fa-trash'); |
99 | 99 | $button->setHtmlAttribute('class', 'btn-danger btn-destroy'); |
100 | 100 | |
101 | - $this->buttons->put('restore', $button = new ControlButton(function (Model $model) { |
|
101 | + $this->buttons->put('restore', $button = new ControlButton(function(Model $model) { |
|
102 | 102 | return $this->getModelConfiguration()->getRestoreUrl($model->getKey()); |
103 | 103 | }, trans('sleeping_owl::lang.table.restore'), 400)); |
104 | - $button->setCondition(function () { |
|
104 | + $button->setCondition(function() { |
|
105 | 105 | return $this->isRestorable(); |
106 | 106 | }); |
107 | 107 | $button->hideText(); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return |
190 | 190 | $this->editable |
191 | 191 | && |
192 | - ! $this->isTrashed() |
|
192 | + !$this->isTrashed() |
|
193 | 193 | && |
194 | 194 | $this->getModelConfiguration()->isEditable( |
195 | 195 | $this->getModel() |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | return |
207 | 207 | $this->deletable |
208 | 208 | && |
209 | - ! $this->isTrashed() |
|
209 | + !$this->isTrashed() |
|
210 | 210 | && |
211 | 211 | $this->getModelConfiguration()->isDeletable( |
212 | 212 | $this->getModel() |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | { |
267 | 267 | return parent::toArray() + [ |
268 | 268 | 'buttons' => $this->buttons |
269 | - ->each(function (ControlButtonInterface $button) { |
|
269 | + ->each(function(ControlButtonInterface $button) { |
|
270 | 270 | $button->setModel($this->getModel()); |
271 | 271 | }) |
272 | - ->filter(function (ControlButtonInterface $button) { |
|
272 | + ->filter(function(ControlButtonInterface $button) { |
|
273 | 273 | return $button->isActive(); |
274 | 274 | }) |
275 | - ->sortBy(function (ControlButtonInterface $button) { |
|
275 | + ->sortBy(function(ControlButtonInterface $button) { |
|
276 | 276 | return $button->getPosition(); |
277 | 277 | }), |
278 | 278 | ]; |