@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function setModel($model) |
| 56 | 56 | { |
| 57 | - if (! class_exists($model)) { |
|
| 57 | + if (!class_exists($model)) { |
|
| 58 | 58 | throw new Exception("Class model [$model] not found"); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -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 | * |
@@ -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 | { |
@@ -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,11 +148,11 @@ 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()->filter(function (DisplayExtensionInterface $ext) { |
|
| 155 | + $params[ 'extensions' ] = $this->getExtensions()->filter(function(DisplayExtensionInterface $ext) { |
|
| 156 | 156 | return $ext instanceof Renderable; |
| 157 | 157 | }); |
| 158 | 158 | |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function getCollection() |
| 177 | 177 | { |
| 178 | - if (! $this->isInitialized()) { |
|
| 178 | + if (!$this->isInitialized()) { |
|
| 179 | 179 | throw new \Exception('Display is not initialized'); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if (! is_null($this->collection)) { |
|
| 182 | + if (!is_null($this->collection)) { |
|
| 183 | 183 | return $this->collection; |
| 184 | 184 | } |
| 185 | 185 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $this->modifyQuery($query); |
| 189 | 189 | |
| 190 | 190 | return $this->collection = $this->usePagination() |
| 191 | - ? $query->paginate($this->paginate, ['*'], $this->pageName) |
|
| 191 | + ? $query->paginate($this->paginate, [ '*' ], $this->pageName) |
|
| 192 | 192 | : $query->get(); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
| 199 | 199 | { |
| 200 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
| 200 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
| 201 | 201 | $extension->modifyQuery($query); |
| 202 | 202 | }); |
| 203 | 203 | } |
@@ -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 | /** |