@@ -89,9 +89,9 @@ |
||
89 | 89 | parent::initialize(); |
90 | 90 | |
91 | 91 | $this->getRepository() |
92 | - ->setParentField($this->getParentField()) |
|
93 | - ->setOrderField($this->getOrderField()) |
|
94 | - ->setRootParentId($this->getRootParentId()); |
|
92 | + ->setParentField($this->getParentField()) |
|
93 | + ->setOrderField($this->getOrderField()) |
|
94 | + ->setRootParentId($this->getRootParentId()); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
292 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
293 | 293 | */ |
294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
295 | 295 | { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
302 | - * @return \Illuminate\Foundation\Application|mixed |
|
302 | + * @return TreeRepositoryInterface |
|
303 | 303 | * @throws \Exception |
304 | 304 | */ |
305 | 305 | protected function makeRepository() |
@@ -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 | $model->fireDisplay()->getRepository()->reorder( |
29 | 29 | Request::input('data') |
30 | 30 | ); |
31 | - }]); |
|
31 | + } ]); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $parameters = []; |
|
43 | + protected $parameters = [ ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var bool |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function setParameter($key, $value) |
210 | 210 | { |
211 | - $this->parameters[$key] = $value; |
|
211 | + $this->parameters[ $key ] = $value; |
|
212 | 212 | |
213 | 213 | return $this; |
214 | 214 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | 'value' => $this->getValue(), |
256 | 256 | 'creatable' => $model->isCreatable(), |
257 | 257 | 'createUrl' => $model->getCreateUrl($this->getParameters() + Request::all()), |
258 | - 'controls' => [app('sleeping_owl.table.column')->treeControl()], |
|
258 | + 'controls' => [ app('sleeping_owl.table.column')->treeControl() ], |
|
259 | 259 | ]; |
260 | 260 | } |
261 | 261 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function getCollection() |
275 | 275 | { |
276 | - if (! $this->isInitialized()) { |
|
276 | + if (!$this->isInitialized()) { |
|
277 | 277 | throw new \Exception('Display is not initialized'); |
278 | 278 | } |
279 | 279 | |
280 | - if (! is_null($this->collection)) { |
|
280 | + if (!is_null($this->collection)) { |
|
281 | 281 | return $this->collection; |
282 | 282 | } |
283 | 283 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
295 | 295 | { |
296 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
296 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
297 | 297 | $extension->modifyQuery($query); |
298 | 298 | }); |
299 | 299 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | { |
307 | 307 | $repository = parent::makeRepository(); |
308 | 308 | |
309 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
309 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
310 | 310 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
311 | 311 | } |
312 | 312 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | $parts = explode('.', $name); |
67 | 67 | $fieldName = array_pop($parts); |
68 | 68 | $relationName = implode('.', $parts); |
69 | - $query->whereHas($relationName, function ($q) use ($search, $fieldName) { |
|
69 | + $query->whereHas($relationName, function($q) use ($search, $fieldName) { |
|
70 | 70 | $this->buildQuery($q, $fieldName, $search); |
71 | 71 | }); |
72 | 72 | } |
@@ -189,7 +189,7 @@ |
||
189 | 189 | $fieldName = array_pop($parts); |
190 | 190 | $relationName = implode('.', $parts); |
191 | 191 | |
192 | - $query->whereHas($relationName, function ($q) use ($name, $time) { |
|
192 | + $query->whereHas($relationName, function($q) use ($name, $time) { |
|
193 | 193 | $this->buildQuery($q, $name, $time); |
194 | 194 | }); |
195 | 195 | } |
@@ -106,14 +106,14 @@ |
||
106 | 106 | $from = array_get($fullSearch, 'from'); |
107 | 107 | $to = array_get($fullSearch, 'to'); |
108 | 108 | |
109 | - if (! empty($from)) { |
|
109 | + if (!empty($from)) { |
|
110 | 110 | $this |
111 | 111 | ->getFrom() |
112 | 112 | ->setOperator(FilterInterface::LESS_OR_EQUAL) |
113 | 113 | ->apply($repository, $column, $query, $from, $fullSearch); |
114 | 114 | } |
115 | 115 | |
116 | - if (! empty($to)) { |
|
116 | + if (!empty($to)) { |
|
117 | 117 | $this |
118 | 118 | ->getTo() |
119 | 119 | ->setOperator(FilterInterface::LESS_OR_EQUAL) |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @var array |
30 | 30 | */ |
31 | - protected $options = []; |
|
31 | + protected $options = [ ]; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var string |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $model = new $model; |
61 | 61 | } |
62 | 62 | |
63 | - if (! ($model instanceof Model)) { |
|
63 | + if (!($model instanceof Model)) { |
|
64 | 64 | throw new \Exception('Model must be an instance of Illuminate\Database\Eloquent\Model'); |
65 | 65 | } |
66 | 66 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function getOptions() |
116 | 116 | { |
117 | - if (! is_null($this->getModel()) and ! is_null($this->getDisplay())) { |
|
117 | + if (!is_null($this->getModel()) and !is_null($this->getDisplay())) { |
|
118 | 118 | $this->loadOptions(); |
119 | 119 | } |
120 | 120 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $parts = explode('.', $name); |
201 | 201 | $fieldName = array_pop($parts); |
202 | 202 | $relationName = implode('.', $parts); |
203 | - $query->whereHas($relationName, function ($q) use ($search, $fieldName) { |
|
203 | + $query->whereHas($relationName, function($q) use ($search, $fieldName) { |
|
204 | 204 | $this->buildQuery($q, $fieldName, $search); |
205 | 205 | }); |
206 | 206 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | protected function loadOptions() |
210 | 210 | { |
211 | - $repository = app(RepositoryInterface::class, [$this->getModel()]); |
|
211 | + $repository = app(RepositoryInterface::class, [ $this->getModel() ]); |
|
212 | 212 | |
213 | 213 | $key = $repository->getModel()->getKeyName(); |
214 | 214 | $options = $repository->getQuery()->get()->lists($this->getDisplay(), $key); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | parent::__construct($label); |
23 | 23 | $this->setLabel( |
24 | - Form::checkbox(null, 1, false, ['class' => 'adminCheckboxAll'] |
|
24 | + Form::checkbox(null, 1, false, [ 'class' => 'adminCheckboxAll' ] |
|
25 | 25 | )); |
26 | 26 | |
27 | 27 | $this->setOrderable(false); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | protected function isEditable() |
65 | 65 | { |
66 | 66 | return |
67 | - ! $this->isTrashed() |
|
67 | + !$this->isTrashed() |
|
68 | 68 | && |
69 | 69 | $this->getModelConfiguration()->isEditable( |
70 | 70 | $this->getModel() |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | protected function isDeletable() |
89 | 89 | { |
90 | 90 | return |
91 | - ! $this->isTrashed() |
|
91 | + !$this->isTrashed() |
|
92 | 92 | && |
93 | 93 | $this->getModelConfiguration()->isDeletable( |
94 | 94 | $this->getModel() |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct($label = null, Closure $callback = null) |
29 | 29 | { |
30 | 30 | parent::__construct($label); |
31 | - if (! is_null($callback)) { |
|
31 | + if (!is_null($callback)) { |
|
32 | 32 | $this->setCallback($callback); |
33 | 33 | } |
34 | 34 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function getValue(Model $model) |
65 | 65 | { |
66 | - if (! is_callable($callback = $this->getCallback())) { |
|
66 | + if (!is_callable($callback = $this->getCallback())) { |
|
67 | 67 | throw new \Exception('Invalid custom column callback'); |
68 | 68 | } |
69 | 69 |
@@ -58,8 +58,8 @@ |
||
58 | 58 | $value = $this->getModelValue(); |
59 | 59 | $originalValue = $value; |
60 | 60 | |
61 | - if (! is_null($value)) { |
|
62 | - if (! $value instanceof Carbon) { |
|
61 | + if (!is_null($value)) { |
|
62 | + if (!$value instanceof Carbon) { |
|
63 | 63 | $value = Carbon::parse($value); |
64 | 64 | } |
65 | 65 |