@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $dates = ['deleted_at']; |
|
27 | + protected $dates = [ 'deleted_at' ]; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * The attributes that should be casted to native types. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | public function modules() |
90 | 90 | { |
91 | - return $this->belongsToMany(Module::class, $this->tablePrefix . 'domains_modules'); |
|
91 | + return $this->belongsToMany(Module::class, $this->tablePrefix.'domains_modules'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | public function menus() |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | * @param boolean $includeItself |
103 | 103 | * @return Collection |
104 | 104 | */ |
105 | - public function parents($includeItself=true) : Collection |
|
105 | + public function parents($includeItself = true) : Collection |
|
106 | 106 | { |
107 | 107 | $parents = new Collection(); |
108 | 108 | |
109 | 109 | if ($includeItself) { |
110 | - $parents[] = $this; |
|
110 | + $parents[ ] = $this; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $domain = $this; |
114 | 114 | |
115 | 115 | while (!is_null($domain->parent)) { |
116 | 116 | $domain = $domain->parent; |
117 | - $parents[] = $domain; |
|
117 | + $parents[ ] = $domain; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return $parents; |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function getAdminModulesAttribute() : array |
139 | 139 | { |
140 | - $modules = []; |
|
140 | + $modules = [ ]; |
|
141 | 141 | |
142 | 142 | foreach ($this->modules()->get() as $module) { |
143 | 143 | if ($module->isAdminModule()) { |
144 | - $modules[] = $module; |
|
144 | + $modules[ ] = $module; |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function getNotAdminModulesAttribute() : array |
157 | 157 | { |
158 | - $modules = []; |
|
158 | + $modules = [ ]; |
|
159 | 159 | |
160 | 160 | foreach ($this->modules()->get() as $module) { |
161 | 161 | if (!$module->isAdminModule()) { |
162 | - $modules[] = $module; |
|
162 | + $modules[ ] = $module; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | - public function __construct(Domain $domain, Module $module, Request $request, $record, $isFromApi=false) |
|
31 | + public function __construct(Domain $domain, Module $module, Request $request, $record, $isFromApi = false) |
|
32 | 32 | { |
33 | 33 | $this->domain = $domain; |
34 | 34 | $this->module = $module; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - public function __construct(Domain $domain, Module $module, Request $request, $record, $mode=null, $isFromApi=false) |
|
32 | + public function __construct(Domain $domain, Module $module, Request $request, $record, $mode = null, $isFromApi = false) |
|
33 | 33 | { |
34 | 34 | $this->domain = $domain; |
35 | 35 | $this->module = $module; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - public function __construct(Domain $domain, ?Module $module, ?Request $request, $record, $mode=null, $isFromApi=false) |
|
32 | + public function __construct(Domain $domain, ?Module $module, ?Request $request, $record, $mode = null, $isFromApi = false) |
|
33 | 33 | { |
34 | 34 | $this->domain = $domain; |
35 | 35 | $this->module = $module; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | * @param \Uccello\Core\Models\Module|null $module |
68 | 68 | * @return string|null |
69 | 69 | */ |
70 | - public function getFormattedValueToSave(Request $request, Field $field, $value, $record=null, ?Domain $domain=null, ?Module $module=null) : ?string; |
|
70 | + public function getFormattedValueToSave(Request $request, Field $field, $value, $record = null, ?Domain $domain = null, ?Module $module = null) : ?string; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Returns formatted value to search. |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | $request = $this->getData('request'); |
25 | 25 | |
26 | 26 | // Make route params |
27 | - $routeParams = []; |
|
27 | + $routeParams = [ ]; |
|
28 | 28 | |
29 | 29 | // Get and add record id to route params if defined |
30 | 30 | $recordId = $this->getModel()->getKey() ?? null; |
31 | 31 | if ($recordId ?? false) { |
32 | - $routeParams['id'] = $recordId; |
|
32 | + $routeParams[ 'id' ] = $recordId; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get mode |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | $relatedlistId = $request->input('relatedlist'); |
94 | 94 | $sourceRecordId = $request->input('src_id'); |
95 | 95 | |
96 | - $this->add('relatedlist', 'hidden', ['value' => $relatedlistId]); |
|
97 | - $this->add('src_id', 'hidden', ['value' => $sourceRecordId]); |
|
96 | + $this->add('relatedlist', 'hidden', [ 'value' => $relatedlistId ]); |
|
97 | + $this->add('src_id', 'hidden', [ 'value' => $sourceRecordId ]); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // Add selected tab data |
101 | 101 | if ($request->input('tab')) { |
102 | 102 | $tabId = $request->input('tab'); |
103 | 103 | |
104 | - $this->add('tab', 'hidden', ['value' => $tabId]); |
|
104 | + $this->add('tab', 'hidden', [ 'value' => $tabId ]); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function getFieldOptions(Field $field): array |
128 | 128 | { |
129 | - $options = []; |
|
129 | + $options = [ ]; |
|
130 | 130 | |
131 | 131 | if ($field->data->repeated ?? false) { |
132 | 132 | $options = $this->getRepeatedFieldOptions($field); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $options = [ |
158 | 158 | 'label' => uctrans($field->label, $module), |
159 | - 'label_attr' => ['class' => 'form-label' . $requiredClass], |
|
159 | + 'label_attr' => [ 'class' => 'form-label'.$requiredClass ], |
|
160 | 160 | 'rules' => $this->getFieldRules($field), |
161 | 161 | 'attr' => [ |
162 | 162 | 'class' => 'form-control' |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | // Set default value only if it is a creation (record id doen't exist) |
171 | 171 | if (is_null($this->getModel()->getKey())) { |
172 | - $options['default_value'] = $selectedValue ?? $field->data->default ?? null; |
|
172 | + $options[ 'default_value' ] = $selectedValue ?? $field->data->default ?? null; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | // Add other options |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | |
211 | 211 | // Second field have default options too, except label and rules (already verified in the first field) |
212 | 212 | $secondFieldOptions = $firstFieldOptions; |
213 | - $secondFieldOptions['label'] = uctrans($field->label.'_confirmation', $module); |
|
214 | - $secondFieldOptions['rules'] = null; |
|
213 | + $secondFieldOptions[ 'label' ] = uctrans($field->label.'_confirmation', $module); |
|
214 | + $secondFieldOptions[ 'rules' ] = null; |
|
215 | 215 | |
216 | 216 | return [ |
217 | 217 | 'type' => $this->getFormBuilderType($field), |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * {@inheritdoc} |
14 | 14 | */ |
15 | - public function save(?Domain $domain, Module $module, Request $request, bool $redirect=true) |
|
15 | + public function save(?Domain $domain, Module $module, Request $request, bool $redirect = true) |
|
16 | 16 | { |
17 | 17 | // Default behaviour without redirection |
18 | 18 | $record = parent::save($domain, $module, $request, false); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // Redirect to detail view (we use $this->domain instead of $domain because slug could have been changed) |
26 | 26 | if ($redirect === true) { |
27 | - $route = ucroute('uccello.detail', $this->domain, $module, ['id' => $record->getKey()]); |
|
27 | + $route = ucroute('uccello.detail', $this->domain, $module, [ 'id' => $record->getKey() ]); |
|
28 | 28 | |
29 | 29 | return redirect($route); |
30 | 30 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | protected function addLinksAddedAfterMenuCreation($links, $domainModules) |
91 | 91 | { |
92 | 92 | if (!empty($links)) { |
93 | - $addedModules = []; |
|
93 | + $addedModules = [ ]; |
|
94 | 94 | $this->getAddedModules($links, $addedModules); |
95 | 95 | |
96 | 96 | foreach ($domainModules as $module) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $link->module = $module->name; |
105 | 105 | $link->color = 'grey'; |
106 | 106 | $link->translation = uctrans($module->name, $module); |
107 | - $links[] = $link; |
|
107 | + $links[ ] = $link; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | { |
124 | 124 | foreach ($links as $link) { |
125 | 125 | if (!empty($link->module) && !in_array($link->module, $addedModules)) { |
126 | - $addedModules[] = $link->module; |
|
126 | + $addedModules[ ] = $link->module; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if (isset($link->children) && is_array($link->children)) { |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function getResultForDatatable(Domain $domain, Module $module, Request $request) |
73 | 73 | { |
74 | - $draw = (int) $request->get('draw'); |
|
75 | - $start = (int) $request->get('start'); |
|
76 | - $length = (int) $request->get('length'); |
|
74 | + $draw = (int)$request->get('draw'); |
|
75 | + $start = (int)$request->get('start'); |
|
76 | + $length = (int)$request->get('length'); |
|
77 | 77 | $order = $request->get('order'); |
78 | 78 | $columns = $request->get('columns'); |
79 | 79 | $recordId = $request->get('id'); |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | |
103 | 103 | // Search by column |
104 | 104 | foreach ($columns as $column) { |
105 | - $fieldName = $column["data"]; |
|
106 | - $searchValue = $column["search"]["value"]; |
|
105 | + $fieldName = $column[ "data" ]; |
|
106 | + $searchValue = $column[ "search" ][ "value" ]; |
|
107 | 107 | |
108 | 108 | // Get field by name and search by field column |
109 | 109 | $field = $module->getField($fieldName); |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | |
120 | 120 | // Order results |
121 | 121 | foreach ($order as $orderInfo) { |
122 | - $columnIndex = (int) $orderInfo["column"]; |
|
123 | - $column = $columns[$columnIndex]; |
|
124 | - $fieldName = $column["data"]; |
|
122 | + $columnIndex = (int)$orderInfo[ "column" ]; |
|
123 | + $column = $columns[ $columnIndex ]; |
|
124 | + $fieldName = $column[ "data" ]; |
|
125 | 125 | |
126 | 126 | // Get field by name and order by field column |
127 | 127 | $field = $module->getField($fieldName); |
128 | 128 | if (!is_null($field)) { |
129 | - $query = $query->orderBy($field->column, $orderInfo["dir"]); |
|
129 | + $query = $query->orderBy($field->column, $orderInfo[ "dir" ]); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if ($relatedList && $relatedList->method) { |
139 | 139 | // Related list method |
140 | 140 | $method = $relatedList->method; |
141 | - $countMethod = $method . 'Count'; |
|
141 | + $countMethod = $method.'Count'; |
|
142 | 142 | |
143 | 143 | // Update query |
144 | 144 | $model = new $modelClass; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $data = $records; |
167 | 167 | |
168 | 168 | } else { |
169 | - $data = []; |
|
169 | + $data = [ ]; |
|
170 | 170 | $total = 0; |
171 | 171 | $totalFiltered = 0; |
172 | 172 | } |