@@ -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 |
@@ -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 |
@@ -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 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function storeAsJson() |
14 | 14 | { |
15 | - $this->mutateValue(function ($value) { |
|
15 | + $this->mutateValue(function($value) { |
|
16 | 16 | return json_encode($value); |
17 | 17 | }); |
18 | 18 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function storeAsComaSeparatedValue() |
28 | 28 | { |
29 | - $this->mutateValue(function ($value) { |
|
29 | + $this->mutateValue(function($value) { |
|
30 | 30 | return implode(',', $value); |
31 | 31 | }); |
32 | 32 | |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | $name = $this->getName(); |
39 | 39 | $value = Request::input($name, ''); |
40 | 40 | |
41 | - if (! empty($value)) { |
|
41 | + if (!empty($value)) { |
|
42 | 42 | $value = explode(',', $value); |
43 | 43 | } else { |
44 | - $value = []; |
|
44 | + $value = [ ]; |
|
45 | 45 | } |
46 | 46 | |
47 | - Request::merge([$name => $value]); |
|
47 | + Request::merge([ $name => $value ]); |
|
48 | 48 | parent::save(); |
49 | 49 | } |
50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $value = parent::getValue(); |
57 | 57 | if (is_null($value)) { |
58 | - $value = []; |
|
58 | + $value = [ ]; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if (is_string($value)) { |