@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | protected $tablePrefix; |
| 13 | 13 | |
| 14 | - public function __construct(array $attributes = []) |
|
| 14 | + public function __construct(array $attributes = [ ]) |
|
| 15 | 15 | { |
| 16 | 16 | parent::__construct($attributes); |
| 17 | 17 | |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function initTableName() |
| 36 | 36 | { |
| 37 | - if($this->table) |
|
| 37 | + if ($this->table) |
|
| 38 | 38 | { |
| 39 | - $this->table = $this->tablePrefix . $this->table; |
|
| 39 | + $this->table = $this->tablePrefix.$this->table; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $viewToInclude = $packageModuleView; |
| 119 | 119 | } elseif (view()->exists($packageDefaultView)) { |
| 120 | 120 | $viewToInclude = $packageDefaultView; |
| 121 | - } elseif (view()->exists($uccelloModuleView)) { |
|
| 121 | + } elseif (view()->exists($uccelloModuleView)) { |
|
| 122 | 122 | $viewToInclude = $uccelloModuleView; |
| 123 | 123 | } elseif (view()->exists($uccelloDefaultView)) { |
| 124 | 124 | $viewToInclude = $uccelloDefaultView; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param string $locale |
| 43 | 43 | * @return \Illuminate\Contracts\Translation\Translator|string|array|null |
| 44 | 44 | */ |
| 45 | - public function trans($key = null, ?Module $module = null, $replace = [], $locale = null) |
|
| 45 | + public function trans($key = null, ?Module $module = null, $replace = [ ], $locale = null) |
|
| 46 | 46 | { |
| 47 | 47 | $translator = app('translator'); |
| 48 | 48 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // 2. Get translation in package |
| 67 | 67 | if (!empty($module->package)) { |
| 68 | 68 | // If a package name is defined add it before |
| 69 | - $prefix = $module->package . '::'. $prefix; |
|
| 69 | + $prefix = $module->package.'::'.$prefix; |
|
| 70 | 70 | |
| 71 | 71 | $translation = $translator->trans($prefix.$key, $replace, $locale); |
| 72 | 72 | if ($translation !== $prefix.$key) { |
@@ -115,22 +115,22 @@ discard block |
||
| 115 | 115 | public function view(string $package, Module $module, string $viewName, ?string $fallbackView = null): ?string |
| 116 | 116 | { |
| 117 | 117 | // Module view overrided in app |
| 118 | - $appModuleView = 'modules.' . $module->name . '.' . $viewName; |
|
| 118 | + $appModuleView = 'modules.'.$module->name.'.'.$viewName; |
|
| 119 | 119 | |
| 120 | 120 | // Default view overrided in app |
| 121 | - $appDefaultView = 'modules.default.' . $viewName; |
|
| 121 | + $appDefaultView = 'modules.default.'.$viewName; |
|
| 122 | 122 | |
| 123 | 123 | // Module view ovverrided in package |
| 124 | - $packageModuleView = $package . '::modules.' . $module->name . '.' . $viewName; |
|
| 124 | + $packageModuleView = $package.'::modules.'.$module->name.'.'.$viewName; |
|
| 125 | 125 | |
| 126 | 126 | // Default view defined in package |
| 127 | - $packageDefaultView = $package . '::modules.default.' . $viewName; |
|
| 127 | + $packageDefaultView = $package.'::modules.default.'.$viewName; |
|
| 128 | 128 | |
| 129 | 129 | // Module view ovverrided in uccello |
| 130 | - $uccelloModuleView = 'uccello::modules.' . $module->name . '.' . $viewName; |
|
| 130 | + $uccelloModuleView = 'uccello::modules.'.$module->name.'.'.$viewName; |
|
| 131 | 131 | |
| 132 | 132 | // Default view defined in uccello |
| 133 | - $uccelloDefaultView = 'uccello::modules.default.' . $viewName; |
|
| 133 | + $uccelloDefaultView = 'uccello::modules.default.'.$viewName; |
|
| 134 | 134 | |
| 135 | 135 | $viewToInclude = null; |
| 136 | 136 | if (view()->exists($appModuleView)) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @param boolean $absolute |
| 163 | 163 | * @return string |
| 164 | 164 | */ |
| 165 | - public function route($name, $domain = null, $module = null, $parameters = [], $absolute = true) : string |
|
| 165 | + public function route($name, $domain = null, $module = null, $parameters = [ ], $absolute = true) : string |
|
| 166 | 166 | { |
| 167 | 167 | if (is_a($domain, Domain::class)) { |
| 168 | 168 | $domain = $domain->slug; |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | // Add domain to route if we use multi domains and if the parameter is needed |
| 179 | 179 | if (!is_null($domain) && uccello()->useMultiDomains() && preg_match('`{domain}`', $routeUri)) { |
| 180 | - $parameters['domain'] = $domain; |
|
| 180 | + $parameters[ 'domain' ] = $domain; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Add module to route if the parameter is needed |
| 184 | 184 | if (!is_null($module) && preg_match('`{module}`', $routeUri)) { |
| 185 | - $parameters['module'] = $module; |
|
| 185 | + $parameters[ 'module' ] = $module; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return route($name, $parameters, $absolute); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | if (is_numeric($nameOrId)) { |
| 212 | 212 | return Module::find($nameOrId); |
| 213 | 213 | } else { |
| 214 | - return Module::where('name', (string) $nameOrId)->first(); |
|
| 214 | + return Module::where('name', (string)$nameOrId)->first(); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | if (is_numeric($nameOrId)) { |
| 227 | 227 | return Uitype::find($nameOrId); |
| 228 | 228 | } else { |
| 229 | - return Uitype::where('name', (string) $nameOrId)->first(); |
|
| 229 | + return Uitype::where('name', (string)$nameOrId)->first(); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | if (is_numeric($nameOrId)) { |
| 242 | 242 | return Displaytype::find($nameOrId); |
| 243 | 243 | } else { |
| 244 | - return Displaytype::where('name', (string) $nameOrId)->first(); |
|
| 244 | + return Displaytype::where('name', (string)$nameOrId)->first(); |
|
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | if (is_numeric($nameOrId)) { |
| 257 | 257 | return Capability::find($nameOrId); |
| 258 | 258 | } else { |
| 259 | - return Capability::where('name', (string) $nameOrId)->first(); |
|
| 259 | + return Capability::where('name', (string)$nameOrId)->first(); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $domain = Auth::user()->lastDomain ?? null; // On login page user is not authenticated |
| 281 | 281 | |
| 282 | 282 | if (!$domain) { |
| 283 | - $domain = $this->getRootDomains()[0]; |
|
| 283 | + $domain = $this->getRootDomains()[ 0 ]; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $domain; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function getDatatableColumns(Module $module): array |
| 296 | 296 | { |
| 297 | - $columns = []; |
|
| 297 | + $columns = [ ]; |
|
| 298 | 298 | |
| 299 | 299 | // Get default filter |
| 300 | 300 | $filter = Filter::where('module_id', $module->id) |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | foreach ($fields as $field) { |
| 308 | 308 | // If the field is not listable, continue |
| 309 | - if (!$field->isListable()){ |
|
| 309 | + if (!$field->isListable()) { |
|
| 310 | 310 | continue; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // Add the field as a new column |
| 314 | - $columns[] = [ |
|
| 314 | + $columns[ ] = [ |
|
| 315 | 315 | 'name' => $field->name, |
| 316 | 316 | 'db_column' => $field->column, |
| 317 | 317 | 'uitype' => $field->uitype->name, |
@@ -36,13 +36,13 @@ |
||
| 36 | 36 | public function getFormOptions($record, Field $field, Module $module) : array |
| 37 | 37 | { |
| 38 | 38 | if (!is_object($field->data)) { |
| 39 | - return []; |
|
| 39 | + return [ ]; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $choices = []; |
|
| 42 | + $choices = [ ]; |
|
| 43 | 43 | if ($field->data->choices) { |
| 44 | 44 | foreach ($field->data->choices as $choice) { |
| 45 | - $choices[$choice] = uctrans($choice, $module); |
|
| 45 | + $choices[ $choice ] = uctrans($choice, $module); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $options = parent::getFormOptions($record, $field, $module); |
| 34 | 34 | |
| 35 | - $options['attr'] = ['class' => 'form-control datepicker']; |
|
| 35 | + $options[ 'attr' ] = [ 'class' => 'form-control datepicker' ]; |
|
| 36 | 36 | |
| 37 | 37 | return $options; |
| 38 | 38 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @param \Uccello\Core\Models\Module|null $module |
| 43 | 43 | * @return string|null |
| 44 | 44 | */ |
| 45 | - public function getFormattedValueToSave(Request $request, Field $field, $value, $record=null, ?Domain $domain=null, ?Module $module=null) : ?string |
|
| 45 | + public function getFormattedValueToSave(Request $request, Field $field, $value, $record = null, ?Domain $domain = null, ?Module $module = null) : ?string |
|
| 46 | 46 | { |
| 47 | 47 | return Hash::make($value); |
| 48 | 48 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function getFormOptions($record, Field $field, Module $module) : array |
| 43 | 43 | { |
| 44 | - $options['attr'] = ['class' => 'form-control timepicker']; |
|
| 44 | + $options[ 'attr' ] = [ 'class' => 'form-control timepicker' ]; |
|
| 45 | 45 | |
| 46 | 46 | return $options; |
| 47 | 47 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | public function getFormOptions($record, Field $field, Module $module) : array |
| 47 | 47 | { |
| 48 | - $options['attr'] = ['class' => 'form-control datetimepicker']; |
|
| 48 | + $options[ 'attr' ] = [ 'class' => 'form-control datetimepicker' ]; |
|
| 49 | 49 | |
| 50 | 50 | return $options; |
| 51 | 51 | } |
@@ -29,13 +29,13 @@ |
||
| 29 | 29 | public function getFormOptions($record, Field $field, Module $module) : array |
| 30 | 30 | { |
| 31 | 31 | if (!is_object($field->data)) { |
| 32 | - return []; |
|
| 32 | + return [ ]; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $options = parent::getFormOptions($record, $field, $module); |
| 36 | 36 | |
| 37 | - $options['expanded'] = true; |
|
| 38 | - $options['multiple'] = $field->data->multiple ?? false; |
|
| 37 | + $options[ 'expanded' ] = true; |
|
| 38 | + $options[ 'multiple' ] = $field->data->multiple ?? false; |
|
| 39 | 39 | |
| 40 | 40 | return $options; |
| 41 | 41 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param \Uccello\Core\Models\Module|null $module |
| 51 | 51 | * @return string|null |
| 52 | 52 | */ |
| 53 | - public function getFormattedValueToSave(Request $request, Field $field, $value, $record=null, ?Domain $domain=null, ?Module $module=null) : ?string |
|
| 53 | + public function getFormattedValueToSave(Request $request, Field $field, $value, $record = null, ?Domain $domain = null, ?Module $module = null) : ?string |
|
| 54 | 54 | { |
| 55 | 55 | //TODO: Delete old file |
| 56 | 56 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // Make directory path |
| 64 | 64 | $directoryPath = isset($fieldData->public) && $fieldData->public === true ? 'public/' : ''; // Public or Private |
| 65 | - $directoryPath .= isset($domain) ? $domain->slug . '/' : ''; // Domain |
|
| 65 | + $directoryPath .= isset($domain) ? $domain->slug.'/' : ''; // Domain |
|
| 66 | 66 | $directoryPath .= isset($fieldData->path) ? trim($fieldData->path, '/') : ''; // Custom directory |
| 67 | 67 | |
| 68 | 68 | // Save file |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | // Delete file |
| 74 | - elseif ($request->input('delete-' . $field->name)) { |
|
| 74 | + elseif ($request->input('delete-'.$field->name)) { |
|
| 75 | 75 | $value = null; |
| 76 | 76 | |
| 77 | 77 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $fieldData = $field->data; |
| 99 | 99 | |
| 100 | 100 | // If the file is defined and is public, get its url |
| 101 | - if ($value && isset($fieldData->public) && $fieldData->public === true ) { |
|
| 101 | + if ($value && isset($fieldData->public) && $fieldData->public === true) { |
|
| 102 | 102 | $value = Storage::url($value); |
| 103 | 103 | } |
| 104 | 104 | |