@@ -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 | } |
@@ -38,13 +38,13 @@ |
||
38 | 38 | // Pre-process |
39 | 39 | $this->preProcess($domain, $module, $request); |
40 | 40 | |
41 | - $mainModules = []; |
|
42 | - $adminModules = []; |
|
41 | + $mainModules = [ ]; |
|
42 | + $adminModules = [ ]; |
|
43 | 43 | foreach (Module::orderBy('id')->get() as $_module) { |
44 | 44 | if ($_module->isAdminModule()) { |
45 | - $adminModules[] = $_module; |
|
45 | + $adminModules[ ] = $_module; |
|
46 | 46 | } else { |
47 | - $mainModules[] = $_module; |
|
47 | + $mainModules[ ] = $_module; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |
@@ -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 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | public function docs($jsonFile = null) |
21 | 21 | { |
22 | 22 | $filePath = config('l5-swagger.paths.docs').'/'. |
23 | - (! is_null($jsonFile) ? $jsonFile : config('l5-swagger.paths.docs_json', 'api-docs.json')); |
|
23 | + (!is_null($jsonFile) ? $jsonFile : config('l5-swagger.paths.docs_json', 'api-docs.json')); |
|
24 | 24 | |
25 | - if (! File::exists($filePath)) { |
|
25 | + if (!File::exists($filePath)) { |
|
26 | 26 | try { |
27 | 27 | Generator::generateDocs(); |
28 | 28 | } catch (\Exception $e) { |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if ($proxy = config('l5-swagger.proxy')) { |
52 | - if (! is_array($proxy)) { |
|
53 | - $proxy = [$proxy]; |
|
52 | + if (!is_array($proxy)) { |
|
53 | + $proxy = [ $proxy ]; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | Request::setTrustedProxies($proxy, \Illuminate\Http\Request::HEADER_X_FORWARDED_ALL); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param boolean $redirect |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function save(?Domain $domain, Module $module, Request $request, bool $redirect=true) |
|
71 | + public function save(?Domain $domain, Module $module, Request $request, bool $redirect = true) |
|
72 | 72 | { |
73 | 73 | // Pre-process |
74 | 74 | $this->preProcess($domain, $module, $request); |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | if ($redirect === true) { |
110 | 110 | // Redirect to source record if a relation was made |
111 | 111 | if (isset($relatedlist) && $redirectToSourceRecord === true) { |
112 | - $params = ['id' => $sourceRecordId]; |
|
112 | + $params = [ 'id' => $sourceRecordId ]; |
|
113 | 113 | |
114 | 114 | // Add tab id if defined to select it automaticaly |
115 | 115 | if ($tabId) { |
116 | - $params['tab'] = $tabId; |
|
116 | + $params[ 'tab' ] = $tabId; |
|
117 | 117 | } |
118 | 118 | // Add related list id to select the related tab automaticaly |
119 | 119 | else { |
120 | - $params['relatedlist'] = $relatedlist->id; |
|
120 | + $params[ 'relatedlist' ] = $relatedlist->id; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | // Else redirect to detail |
131 | 131 | else { |
132 | - $route = ucroute('uccello.detail', $domain, $module, ['id' => $record->getKey()]); |
|
132 | + $route = ucroute('uccello.detail', $domain, $module, [ 'id' => $record->getKey() ]); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return redirect($route); |
@@ -31,10 +31,10 @@ |
||
31 | 31 | $recordId = $request->input('id'); |
32 | 32 | |
33 | 33 | // Selected tab |
34 | - $selectedTabId = (int) $request->input('tab'); |
|
34 | + $selectedTabId = (int)$request->input('tab'); |
|
35 | 35 | |
36 | 36 | // Selected related list |
37 | - $selectedRelatedlistId = (int) $request->input('relatedlist'); |
|
37 | + $selectedRelatedlistId = (int)$request->input('relatedlist'); |
|
38 | 38 | |
39 | 39 | return $this->autoView([ |
40 | 40 | 'record' => $this->getRecord($recordId), |
@@ -68,15 +68,15 @@ |
||
68 | 68 | |
69 | 69 | // Redirect to source record if a relation was deleted |
70 | 70 | if (isset($relatedlist) && $request->input('src_id')) { |
71 | - $params = ['id' => $request->input('src_id')]; |
|
71 | + $params = [ 'id' => $request->input('src_id') ]; |
|
72 | 72 | |
73 | 73 | // Add tab id if defined to select it automaticaly |
74 | 74 | if ($request->input('tab')) { |
75 | - $params['tab'] = $request->input('tab'); |
|
75 | + $params[ 'tab' ] = $request->input('tab'); |
|
76 | 76 | } |
77 | 77 | // Add related list id to select the related tab automaticaly |
78 | 78 | else { |
79 | - $params['relatedlist'] = $relatedlist->id; |
|
79 | + $params[ 'relatedlist' ] = $relatedlist->id; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params); |