@@ -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); |
@@ -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 | |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | - * @return string |
|
| 148 | + * @return \Illuminate\Support\Collection |
|
| 149 | 149 | */ |
| 150 | 150 | public function getRedirect() |
| 151 | 151 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @var array |
| 71 | 71 | */ |
| 72 | - protected $redirect = ['edit' => 'edit', 'create' => 'edit']; |
|
| 72 | + protected $redirect = [ 'edit' => 'edit', 'create' => 'edit' ]; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @var Closure|null |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | public function isCreatable() |
| 370 | 370 | { |
| 371 | - if (! is_callable($this->getCreate())) { |
|
| 371 | + if (!is_callable($this->getCreate())) { |
|
| 372 | 372 | return false; |
| 373 | 373 | } |
| 374 | 374 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | public function isEditable(Model $model) |
| 394 | 394 | { |
| 395 | - if (! is_callable($this->getEdit())) { |
|
| 395 | + if (!is_callable($this->getEdit())) { |
|
| 396 | 396 | return false; |
| 397 | 397 | } |
| 398 | 398 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | public function fireDisplay() |
| 504 | 504 | { |
| 505 | - if (! is_callable($this->display)) { |
|
| 505 | + if (!is_callable($this->display)) { |
|
| 506 | 506 | return; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | */ |
| 521 | 521 | public function fireCreate() |
| 522 | 522 | { |
| 523 | - if (! is_callable($this->create)) { |
|
| 523 | + if (!is_callable($this->create)) { |
|
| 524 | 524 | return; |
| 525 | 525 | } |
| 526 | 526 | |
@@ -547,11 +547,11 @@ discard block |
||
| 547 | 547 | */ |
| 548 | 548 | public function fireEdit($id) |
| 549 | 549 | { |
| 550 | - if (! is_callable($this->edit)) { |
|
| 550 | + if (!is_callable($this->edit)) { |
|
| 551 | 551 | return; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - $form = app()->call($this->edit, ['id' => $id]); |
|
| 554 | + $form = app()->call($this->edit, [ 'id' => $id ]); |
|
| 555 | 555 | if ($form instanceof DisplayInterface) { |
| 556 | 556 | $form->setModelClass($this->getClass()); |
| 557 | 557 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | public function fireDelete($id) |
| 577 | 577 | { |
| 578 | 578 | if (is_callable($this->getDelete())) { |
| 579 | - return app()->call($this->getDelete(), [$id]); |
|
| 579 | + return app()->call($this->getDelete(), [ $id ]); |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | public function fireDestroy($id) |
| 589 | 589 | { |
| 590 | 590 | if (is_callable($this->getDestroy())) { |
| 591 | - return app()->call($this->getDestroy(), [$id]); |
|
| 591 | + return app()->call($this->getDestroy(), [ $id ]); |
|
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | 594 | |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | public function fireRestore($id) |
| 601 | 601 | { |
| 602 | 602 | if (is_callable($this->getRestore())) { |
| 603 | - return app()->call($this->getRestore(), [$id]); |
|
| 603 | + return app()->call($this->getRestore(), [ $id ]); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | return $this->getRestore(); |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $repository = $this->getRepository(); |
| 745 | 745 | $item = $repository->find($id); |
| 746 | 746 | |
| 747 | - if (is_null($item) || ! $this->isEditable($item)) { |
|
| 747 | + if (is_null($item) || !$this->isEditable($item)) { |
|
| 748 | 748 | abort(404); |
| 749 | 749 | } |
| 750 | 750 | |
@@ -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 | |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $routeName = 'admin.form.element.dependent-select'; |
| 20 | 20 | |
| 21 | - if (! $router->has($routeName)) { |
|
| 22 | - $router->post('{adminModel}/dependent-select/{field}/{id?}', ['as' => $routeName, function ( |
|
| 21 | + if (!$router->has($routeName)) { |
|
| 22 | + $router->post('{adminModel}/dependent-select/{field}/{id?}', [ 'as' => $routeName, function( |
|
| 23 | 23 | Request $request, |
| 24 | 24 | ModelConfigurationInterface $model, |
| 25 | 25 | $field, |
| 26 | 26 | $id = null |
| 27 | 27 | ) { |
| 28 | 28 | |
| 29 | - if (! is_null($id)) { |
|
| 29 | + if (!is_null($id)) { |
|
| 30 | 30 | $item = $model->getRepository()->find($id); |
| 31 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 31 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 32 | 32 | return new JsonResponse([ |
| 33 | 33 | 'message' => trans('lang.message.access_denied'), |
| 34 | 34 | ], 403); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $form = $model->fireEdit($id); |
| 38 | 38 | } else { |
| 39 | - if (! $model->isCreatable()) { |
|
| 39 | + if (!$model->isCreatable()) { |
|
| 40 | 40 | return new JsonResponse([ |
| 41 | 41 | 'message' => trans('lang.message.access_denied'), |
| 42 | 42 | ], 403); |
@@ -52,24 +52,24 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $element->setAjaxParameters( |
| 55 | - $request->input('depdrop_all_params', []) |
|
| 55 | + $request->input('depdrop_all_params', [ ]) |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | $options = $element->getOptions(); |
| 59 | 59 | |
| 60 | 60 | if ($element->isNullable()) { |
| 61 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
| 61 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $options = array_except($options, $element->exclude); |
| 65 | 65 | |
| 66 | 66 | return new JsonResponse([ |
| 67 | 67 | 'output' => collect($options)->map(function($value, $key) { |
| 68 | - return ['id' => $key, 'name' => $value]; |
|
| 68 | + return [ 'id' => $key, 'name' => $value ]; |
|
| 69 | 69 | }), |
| 70 | 70 | 'selected' => $element->getValue() |
| 71 | 71 | ]); |
| 72 | - }]); |
|
| 72 | + } ]); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * @var array |
| 83 | 83 | */ |
| 84 | - protected $dataDepends = []; |
|
| 84 | + protected $dataDepends = [ ]; |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @var array |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | * @param null $label |
| 96 | 96 | * @param array $depends |
| 97 | 97 | */ |
| 98 | - public function __construct($path, $label = null, array $depends = []) |
|
| 98 | + public function __construct($path, $label = null, array $depends = [ ]) |
|
| 99 | 99 | { |
| 100 | - parent::__construct($path, $label, []); |
|
| 100 | + parent::__construct($path, $label, [ ]); |
|
| 101 | 101 | |
| 102 | 102 | $this->setDataDepends($depends); |
| 103 | 103 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | ]; |
| 184 | 184 | |
| 185 | 185 | if ($this->isReadonly()) { |
| 186 | - $attributes['disabled'] = 'disabled'; |
|
| 186 | + $attributes[ 'disabled' ] = 'disabled'; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | return [ |