@@ -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 | ]; |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | public static function registerRoutes(Router $router) |
24 | 24 | { |
25 | 25 | $routeName = 'admin.display.tree.reorder'; |
26 | - if (! $router->has($routeName)) { |
|
27 | - $router->post('{adminModel}/reorder', ['as' => $routeName, function (ModelConfigurationInterface $model) { |
|
26 | + if (!$router->has($routeName)) { |
|
27 | + $router->post('{adminModel}/reorder', [ 'as' => $routeName, function(ModelConfigurationInterface $model) { |
|
28 | 28 | $display = $model->fireDisplay(); |
29 | 29 | |
30 | 30 | if ($display instanceof DisplayTabbed) { |
31 | - $display->getTabs()->each(function ($tab) { |
|
31 | + $display->getTabs()->each(function($tab) { |
|
32 | 32 | $content = $tab->getContent(); |
33 | 33 | if ($content instanceof self) { |
34 | 34 | $content->getRepository()->reorder( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | Request::input('data') |
42 | 42 | ); |
43 | 43 | } |
44 | - }]); |
|
44 | + } ]); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - protected $parameters = []; |
|
56 | + protected $parameters = [ ]; |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @var bool |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function setParameter($key, $value) |
223 | 223 | { |
224 | - $this->parameters[$key] = $value; |
|
224 | + $this->parameters[ $key ] = $value; |
|
225 | 225 | |
226 | 226 | return $this; |
227 | 227 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | 'value' => $this->getValue(), |
269 | 269 | 'creatable' => $model->isCreatable(), |
270 | 270 | 'createUrl' => $model->getCreateUrl($this->getParameters() + Request::all()), |
271 | - 'controls' => [app('sleeping_owl.table.column')->treeControl()], |
|
271 | + 'controls' => [ app('sleeping_owl.table.column')->treeControl() ], |
|
272 | 272 | ]; |
273 | 273 | } |
274 | 274 | |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function getCollection() |
288 | 288 | { |
289 | - if (! $this->isInitialized()) { |
|
289 | + if (!$this->isInitialized()) { |
|
290 | 290 | throw new \Exception('Display is not initialized'); |
291 | 291 | } |
292 | 292 | |
293 | - if (! is_null($this->collection)) { |
|
293 | + if (!is_null($this->collection)) { |
|
294 | 294 | return $this->collection; |
295 | 295 | } |
296 | 296 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
312 | 312 | { |
313 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
313 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
314 | 314 | $extension->modifyQuery($query); |
315 | 315 | }); |
316 | 316 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | { |
324 | 324 | $repository = parent::makeRepository(); |
325 | 325 | |
326 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
326 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
327 | 327 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
328 | 328 | } |
329 | 329 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @var array |
33 | 33 | */ |
34 | - protected $parameters = []; |
|
34 | + protected $parameters = [ ]; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @var int|null |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | parent::initialize(); |
73 | 73 | |
74 | 74 | if ($this->getModelConfiguration()->isRestorableModel()) { |
75 | - $this->setApply(function ($q) { |
|
75 | + $this->setApply(function($q) { |
|
76 | 76 | return $q->withTrashed(); |
77 | 77 | }); |
78 | 78 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function setParameter($key, $value) |
134 | 134 | { |
135 | - $this->parameters[$key] = $value; |
|
135 | + $this->parameters[ $key ] = $value; |
|
136 | 136 | |
137 | 137 | return $this; |
138 | 138 | } |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | |
179 | 179 | $params = parent::toArray(); |
180 | 180 | |
181 | - $params['creatable'] = $model->isCreatable(); |
|
182 | - $params['createUrl'] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
183 | - $params['collection'] = $this->getCollection(); |
|
181 | + $params[ 'creatable' ] = $model->isCreatable(); |
|
182 | + $params[ 'createUrl' ] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
183 | + $params[ 'collection' ] = $this->getCollection(); |
|
184 | 184 | |
185 | - $params['extensions'] = $this->getExtensions() |
|
186 | - ->filter(function (DisplayExtensionInterface $ext) { |
|
185 | + $params[ 'extensions' ] = $this->getExtensions() |
|
186 | + ->filter(function(DisplayExtensionInterface $ext) { |
|
187 | 187 | return $ext instanceof Renderable; |
188 | 188 | }) |
189 | - ->sortBy(function (DisplayExtensionInterface $extension) { |
|
189 | + ->sortBy(function(DisplayExtensionInterface $extension) { |
|
190 | 190 | return $extension->getOrder(); |
191 | 191 | }); |
192 | 192 | |
193 | - $params['newEntryButtonText'] = $this->getNewEntryButtonText(); |
|
193 | + $params[ 'newEntryButtonText' ] = $this->getNewEntryButtonText(); |
|
194 | 194 | |
195 | 195 | return $params; |
196 | 196 | } |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getCollection() |
203 | 203 | { |
204 | - if (! $this->isInitialized()) { |
|
204 | + if (!$this->isInitialized()) { |
|
205 | 205 | throw new \Exception('Display is not initialized'); |
206 | 206 | } |
207 | 207 | |
208 | - if (! is_null($this->collection)) { |
|
208 | + if (!is_null($this->collection)) { |
|
209 | 209 | return $this->collection; |
210 | 210 | } |
211 | 211 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $this->applyOrders($query); |
216 | 216 | |
217 | 217 | return $this->collection = $this->usePagination() |
218 | - ? $query->paginate($this->paginate, ['*'], $this->pageName)->appends(request()->except($this->pageName)) |
|
218 | + ? $query->paginate($this->paginate, [ '*' ], $this->pageName)->appends(request()->except($this->pageName)) |
|
219 | 219 | : $query->get(); |
220 | 220 | } |
221 | 221 | |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | */ |
227 | 227 | protected function applyOrders(Builder $query) |
228 | 228 | { |
229 | - $orders = Request::input('order', []); |
|
229 | + $orders = Request::input('order', [ ]); |
|
230 | 230 | |
231 | 231 | $columns = $this->getColumns()->all(); |
232 | 232 | |
233 | - if (! is_int(key($orders))) { |
|
234 | - $orders = [$orders]; |
|
233 | + if (!is_int(key($orders))) { |
|
234 | + $orders = [ $orders ]; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | foreach ($orders as $order) { |
238 | 238 | $columnIndex = array_get($order, 'column'); |
239 | 239 | $direction = array_get($order, 'dir', 'asc'); |
240 | 240 | |
241 | - if (! $columnIndex && $columnIndex !== '0') { |
|
241 | + if (!$columnIndex && $columnIndex !== '0') { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
257 | 257 | { |
258 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
258 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
259 | 259 | $extension->modifyQuery($query); |
260 | 260 | }); |
261 | 261 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | $value = $this->getValue(); |
13 | 13 | |
14 | - if (! $this->hasClassProperty('label-', 'bg-')) { |
|
14 | + if (!$this->hasClassProperty('label-', 'bg-')) { |
|
15 | 15 | $this->setHtmlAttribute('class', 'label-primary'); |
16 | 16 | } |
17 | 17 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getModelConfiguration() |
33 | 33 | { |
34 | - if (! $this->hasModel()) { |
|
34 | + if (!$this->hasModel()) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function hasModel() |
45 | 45 | { |
46 | - return ! is_null($this->model) and class_exists($this->model); |
|
46 | + return !is_null($this->model) and class_exists($this->model); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
90 | - if (! is_callable($this->accessLogic)) { |
|
90 | + if (!is_callable($this->accessLogic)) { |
|
91 | 91 | if ($this->hasModel()) { |
92 | - return function () { |
|
92 | + return function() { |
|
93 | 93 | return $this->getModelConfiguration()->isDisplayable(); |
94 | 94 | }; |
95 | 95 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $data = $this->toArray(); |
109 | 109 | |
110 | - if (! is_null($view)) { |
|
110 | + if (!is_null($view)) { |
|
111 | 111 | return view($view, $data)->render(); |
112 | 112 | } |
113 | 113 |
@@ -31,8 +31,8 @@ |
||
31 | 31 | $type = strtolower(substr($name, 3)); |
32 | 32 | |
33 | 33 | if (starts_with($name, 'add') && array_key_exists($type, $this->types)) { |
34 | - if (isset($arguments[0])) { |
|
35 | - return call_user_func("{$this->types[$type]}::addMessage", $arguments[0]); |
|
34 | + if (isset($arguments[ 0 ])) { |
|
35 | + return call_user_func("{$this->types[ $type ]}::addMessage", $arguments[ 0 ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | throw new InvalidArgumentException("Method [{$name}] expected parameter"); |