@@ -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 |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $this->repository = $this->makeRepository(); |
156 | 156 | $this->repository->with($this->with); |
157 | 157 | |
158 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
158 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
159 | 159 | if ($extension instanceof Initializable) { |
160 | 160 | $extension->initialize(); |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($extension instanceof Placable) { |
164 | 164 | $template = app('sleeping_owl.template')->getViewPath($this->getView()); |
165 | 165 | |
166 | - view()->composer($template, function (\Illuminate\View\View $view) use ($extension) { |
|
166 | + view()->composer($template, function(\Illuminate\View\View $view) use ($extension) { |
|
167 | 167 | $view->getFactory()->inject( |
168 | 168 | $extension->getPlacement(), |
169 | 169 | app('sleeping_owl.template')->view($extension->getView(), $extension->toArray())->render() |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | $this->title, |
201 | 201 | ]; |
202 | 202 | |
203 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
203 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
204 | 204 | if (method_exists($extension, $method = 'getTitle')) { |
205 | - $titles[] = call_user_func([$extension, $method]); |
|
205 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
206 | 206 | } |
207 | 207 | }); |
208 | 208 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $extension = $this->extensions->get($method); |
278 | 278 | |
279 | 279 | if (method_exists($extension, 'set')) { |
280 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
280 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -297,6 +297,6 @@ discard block |
||
297 | 297 | */ |
298 | 298 | protected function makeRepository() |
299 | 299 | { |
300 | - return app($this->repositoryClass, [$this->modelClass]); |
|
300 | + return app($this->repositoryClass, [ $this->modelClass ]); |
|
301 | 301 | } |
302 | 302 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @var array |
13 | 13 | */ |
14 | - protected $order = [[0, 'asc']]; |
|
14 | + protected $order = [ [ 0, 'asc' ] ]; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @var array |
18 | 18 | */ |
19 | - protected $datatableAttributes = []; |
|
19 | + protected $datatableAttributes = [ ]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var int |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $this->setHtmlAttribute('data-order', json_encode($this->getOrder())); |
40 | 40 | |
41 | 41 | $attributes = $this->getDatatableAttributes(); |
42 | - $attributes['pageLength'] = $this->paginate; |
|
42 | + $attributes[ 'pageLength' ] = $this->paginate; |
|
43 | 43 | |
44 | - $attributes['language'] = trans('sleeping_owl::lang.table'); |
|
44 | + $attributes[ 'language' ] = trans('sleeping_owl::lang.table'); |
|
45 | 45 | |
46 | 46 | foreach ($this->getColumns()->all() as $column) { |
47 | - $attributes['columns'][] = [ |
|
47 | + $attributes[ 'columns' ][ ] = [ |
|
48 | 48 | 'orderDataType' => class_basename($column), |
49 | 49 | ]; |
50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getDatatableAttributes() |
59 | 59 | { |
60 | - return array_merge(config('sleeping_owl.datatables', []), (array) $this->datatableAttributes); |
|
60 | + return array_merge(config('sleeping_owl.datatables', [ ]), (array) $this->datatableAttributes); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setOrder($order) |
89 | 89 | { |
90 | - if (! is_array($order)) { |
|
90 | + if (!is_array($order)) { |
|
91 | 91 | $order = func_get_args(); |
92 | 92 | } |
93 | 93 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $params = parent::toArray(); |
124 | 124 | |
125 | - $params['order'] = $this->getOrder(); |
|
125 | + $params[ 'order' ] = $this->getOrder(); |
|
126 | 126 | |
127 | 127 | return $params; |
128 | 128 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @var DisplayTab[] |
16 | 16 | */ |
17 | - protected $tabs = []; |
|
17 | + protected $tabs = [ ]; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var string |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | $tab = app('sleeping_owl.display')->tab($display)->setLabel($label)->setActive($active); |
81 | 81 | |
82 | - $this->tabs[] = $tab; |
|
82 | + $this->tabs[ ] = $tab; |
|
83 | 83 | |
84 | 84 | return $tab; |
85 | 85 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | foreach ($this->getTabs() as $tab) { |
119 | 119 | if ($tab instanceof FormInterface) { |
120 | 120 | $result = $tab->validateForm($model); |
121 | - if (! is_null($result)) { |
|
121 | + if (!is_null($result)) { |
|
122 | 122 | return $result; |
123 | 123 | } |
124 | 124 | } |
@@ -13,7 +13,6 @@ |
||
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class DisplayTable. |
16 | - |
|
17 | 16 | * @method Columns getColumns() |
18 | 17 | * @method $this setColumns(ColumnInterface $column, ... $columns) |
19 | 18 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @var array |
32 | 32 | */ |
33 | - protected $parameters = []; |
|
33 | + protected $parameters = [ ]; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var int|null |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | parent::initialize(); |
67 | 67 | |
68 | 68 | if ($this->getModelConfiguration()->isRestorableModel()) { |
69 | - $this->setApply(function ($q) { |
|
69 | + $this->setApply(function($q) { |
|
70 | 70 | return $q->withTrashed(); |
71 | 71 | }); |
72 | 72 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setParameter($key, $value) |
104 | 104 | { |
105 | - $this->parameters[$key] = $value; |
|
105 | + $this->parameters[ $key ] = $value; |
|
106 | 106 | |
107 | 107 | return $this; |
108 | 108 | } |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | |
149 | 149 | $params = parent::toArray(); |
150 | 150 | |
151 | - $params['creatable'] = $model->isCreatable(); |
|
152 | - $params['createUrl'] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
153 | - $params['collection'] = $this->getCollection(); |
|
151 | + $params[ 'creatable' ] = $model->isCreatable(); |
|
152 | + $params[ 'createUrl' ] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
153 | + $params[ 'collection' ] = $this->getCollection(); |
|
154 | 154 | |
155 | - $params['extensions'] = $this->getExtensions() |
|
156 | - ->filter(function (DisplayExtensionInterface $ext) { |
|
155 | + $params[ 'extensions' ] = $this->getExtensions() |
|
156 | + ->filter(function(DisplayExtensionInterface $ext) { |
|
157 | 157 | return $ext instanceof Renderable; |
158 | 158 | }) |
159 | - ->sortBy(function (DisplayExtensionInterface $extension) { |
|
159 | + ->sortBy(function(DisplayExtensionInterface $extension) { |
|
160 | 160 | return $extension->getOrder(); |
161 | 161 | }); |
162 | 162 | |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function getCollection() |
181 | 181 | { |
182 | - if (! $this->isInitialized()) { |
|
182 | + if (!$this->isInitialized()) { |
|
183 | 183 | throw new \Exception('Display is not initialized'); |
184 | 184 | } |
185 | 185 | |
186 | - if (! is_null($this->collection)) { |
|
186 | + if (!is_null($this->collection)) { |
|
187 | 187 | return $this->collection; |
188 | 188 | } |
189 | 189 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->modifyQuery($query); |
193 | 193 | |
194 | 194 | return $this->collection = $this->usePagination() |
195 | - ? $query->paginate($this->paginate, ['*'], $this->pageName) |
|
195 | + ? $query->paginate($this->paginate, [ '*' ], $this->pageName) |
|
196 | 196 | : $query->get(); |
197 | 197 | } |
198 | 198 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
203 | 203 | { |
204 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
204 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
205 | 205 | $extension->modifyQuery($query); |
206 | 206 | }); |
207 | 207 | } |
@@ -283,7 +283,7 @@ |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
286 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
287 | 287 | */ |
288 | 288 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
289 | 289 | { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $this->header = app(TableHeaderColumnInterface::class); |
57 | 57 | |
58 | - if (! is_null($label)) { |
|
58 | + if (!is_null($label)) { |
|
59 | 59 | $this->setLabel($label); |
60 | 60 | } |
61 | 61 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->model = $model; |
160 | 160 | $append = $this->getAppends(); |
161 | 161 | |
162 | - if (! is_null($append)) { |
|
162 | + if (!is_null($append)) { |
|
163 | 163 | $append->setModel($model); |
164 | 164 | } |
165 | 165 |
@@ -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) |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function toArray() |
42 | 42 | { |
43 | - return []; |
|
43 | + return [ ]; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |