@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - protected $with = []; |
|
53 | + protected $with = [ ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @var string |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->repository = $this->makeRepository(); |
168 | 168 | $this->repository->with($this->with); |
169 | 169 | |
170 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
170 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
171 | 171 | if ($extension instanceof Initializable) { |
172 | 172 | $extension->initialize(); |
173 | 173 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | $this->title, |
202 | 202 | ]; |
203 | 203 | |
204 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
204 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
205 | 205 | if (method_exists($extension, $method = 'getTitle')) { |
206 | - $titles[] = call_user_func([$extension, $method]); |
|
206 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
207 | 207 | } |
208 | 208 | }); |
209 | 209 | |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | { |
266 | 266 | $view = app('sleeping_owl.template')->view($this->getView(), $this->toArray()); |
267 | 267 | |
268 | - $blocks = []; |
|
268 | + $blocks = [ ]; |
|
269 | 269 | |
270 | - $placableExtensions = $this->getExtensions()->filter(function ($extension) { |
|
270 | + $placableExtensions = $this->getExtensions()->filter(function($extension) { |
|
271 | 271 | return $extension instanceof Placable; |
272 | 272 | }); |
273 | 273 | |
274 | 274 | foreach ($placableExtensions as $extension) { |
275 | - $blocks[$extension->getPlacement()][] = (string) app('sleeping_owl.template')->view( |
|
275 | + $blocks[ $extension->getPlacement() ][ ] = (string) app('sleeping_owl.template')->view( |
|
276 | 276 | $extension->getView(), |
277 | 277 | $extension->toArray() |
278 | 278 | ); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | foreach ($blocks as $block => $data) { |
282 | 282 | foreach ($data as $html) { |
283 | - if (! empty($html)) { |
|
283 | + if (!empty($html)) { |
|
284 | 284 | $view->getFactory()->startSection($block); |
285 | 285 | echo $html; |
286 | 286 | $view->getFactory()->yieldSection(); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $extension = $this->extensions->get($method); |
316 | 316 | |
317 | 317 | if (method_exists($extension, 'set')) { |
318 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
318 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | */ |
337 | 337 | protected function makeRepository() |
338 | 338 | { |
339 | - $repository = app($this->repositoryClass, [$this->modelClass]); |
|
339 | + $repository = app($this->repositoryClass, [ $this->modelClass ]); |
|
340 | 340 | |
341 | - if (! ($repository instanceof RepositoryInterface)) { |
|
341 | + if (!($repository instanceof RepositoryInterface)) { |
|
342 | 342 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
343 | 343 | } |
344 | 344 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $dates = explode('::', $date); |
38 | 38 | |
39 | 39 | foreach ($dates as $i => $date) { |
40 | - $dates[$i] = parent::parserValue($date); |
|
40 | + $dates[ $i ] = parent::parserValue($date); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $dates; |
@@ -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 | } |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | |
119 | 119 | $name = $column->getName(); |
120 | 120 | |
121 | - if (! empty($from) && ! empty($to)) { |
|
121 | + if (!empty($from) && !empty($to)) { |
|
122 | 122 | $this->setOperator('between'); |
123 | - $search = [$from, $to]; |
|
124 | - } elseif (! empty($from)) { |
|
123 | + $search = [ $from, $to ]; |
|
124 | + } elseif (!empty($from)) { |
|
125 | 125 | $this->setOperator('greater_or_equal'); |
126 | 126 | $search = $from; |
127 | - } elseif (! empty($to)) { |
|
127 | + } elseif (!empty($to)) { |
|
128 | 128 | $this->setOperator('less_or_equal'); |
129 | 129 | $search = $to; |
130 | 130 | } else { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $parts = explode('.', $name); |
138 | 138 | $fieldName = array_pop($parts); |
139 | 139 | $relationName = implode('.', $parts); |
140 | - $query->whereHas($relationName, function ($q) use ($search, $fieldName) { |
|
140 | + $query->whereHas($relationName, function($q) use ($search, $fieldName) { |
|
141 | 141 | $this->buildQuery($q, $fieldName, $search); |
142 | 142 | }); |
143 | 143 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | protected function callCallable(Builder $query, $direction) |
54 | 54 | { |
55 | - call_user_func_array($this->name, [$query, $direction]); |
|
55 | + call_user_func_array($this->name, [ $query, $direction ]); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setOrderable($orderable = true) |
75 | 75 | { |
76 | - if ($orderable !== false && ! $orderable instanceof OrderByClauseInterface) { |
|
77 | - if (! is_string($orderable) && ! $orderable instanceof Closure) { |
|
76 | + if ($orderable !== false && !$orderable instanceof OrderByClauseInterface) { |
|
77 | + if (!is_string($orderable) && !$orderable instanceof Closure) { |
|
78 | 78 | $orderable = $this->getName(); |
79 | 79 | } |
80 | 80 | |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | |
119 | 119 | if ($instance instanceof Collection) { |
120 | 120 | $instance = $instance->pluck($part); |
121 | - } elseif (! is_null($instance)) { |
|
121 | + } elseif (!is_null($instance)) { |
|
122 | 122 | $instance = $instance->getAttribute($part); |
123 | 123 | } |
124 | 124 | |
125 | - if (! empty($parts) && ! is_null($instance)) { |
|
125 | + if (!empty($parts) && !is_null($instance)) { |
|
126 | 126 | return $this->getValueFromObject($instance, implode('.', $parts)); |
127 | 127 | } |
128 | 128 |
@@ -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 | ]; |
@@ -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; |