@@ -12,33 +12,33 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class RouteServiceProvider extends DefaultRouteServiceProvider |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @inheritDoc |
|
| 17 | - */ |
|
| 18 | - public function boot() |
|
| 19 | - { |
|
| 15 | + /** |
|
| 16 | + * @inheritDoc |
|
| 17 | + */ |
|
| 18 | + public function boot() |
|
| 19 | + { |
|
| 20 | 20 | parent::boot(); |
| 21 | 21 | |
| 22 | 22 | // Bind domain |
| 23 | 23 | Route::bind('domain', function ($value) { |
| 24 | - return Domain::where('slug', $value)->first() ?? abort(404); |
|
| 24 | + return Domain::where('slug', $value)->first() ?? abort(404); |
|
| 25 | 25 | }); |
| 26 | 26 | |
| 27 | 27 | // Bind module |
| 28 | 28 | Route::bind('module', function ($value) { |
| 29 | - return Module::where('name', $value)->first() ?? abort(404); |
|
| 29 | + return Module::where('name', $value)->first() ?? abort(404); |
|
| 30 | 30 | }); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @inheritDoc |
|
| 35 | - */ |
|
| 36 | - public function map() |
|
| 37 | - { |
|
| 33 | + /** |
|
| 34 | + * @inheritDoc |
|
| 35 | + */ |
|
| 36 | + public function map() |
|
| 37 | + { |
|
| 38 | 38 | parent::map(); |
| 39 | 39 | |
| 40 | 40 | $this->mapUccelloRoutes(); |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Define "uccello" routes for the application. |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | protected function mapUccelloRoutes() |
| 49 | 49 | { |
| 50 | - // API |
|
| 51 | - Route::prefix('api') |
|
| 52 | - ->middleware('api') |
|
| 53 | - ->namespace('Uccello\Core\Http\Controllers') // We prefer to do this instead of modifying $this->namespace, else LoginController is not find |
|
| 54 | - ->group(__DIR__.'/../../routes/api.php'); |
|
| 55 | - |
|
| 56 | - // Web |
|
| 57 | - Route::middleware('web', 'auth') |
|
| 50 | + // API |
|
| 51 | + Route::prefix('api') |
|
| 52 | + ->middleware('api') |
|
| 53 | + ->namespace('Uccello\Core\Http\Controllers') // We prefer to do this instead of modifying $this->namespace, else LoginController is not find |
|
| 54 | + ->group(__DIR__.'/../../routes/api.php'); |
|
| 55 | + |
|
| 56 | + // Web |
|
| 57 | + Route::middleware('web', 'auth') |
|
| 58 | 58 | ->namespace('Uccello\Core\Http\Controllers') // We prefer to do this instead of modifying $this->namespace, else LoginController is not find |
| 59 | 59 | ->group(__DIR__.'/../../routes/web.php'); |
| 60 | 60 | } |
@@ -20,12 +20,12 @@ |
||
| 20 | 20 | parent::boot(); |
| 21 | 21 | |
| 22 | 22 | // Bind domain |
| 23 | - Route::bind('domain', function ($value) { |
|
| 23 | + Route::bind('domain', function($value) { |
|
| 24 | 24 | return Domain::where('slug', $value)->first() ?? abort(404); |
| 25 | 25 | }); |
| 26 | 26 | |
| 27 | 27 | // Bind module |
| 28 | - Route::bind('module', function ($value) { |
|
| 28 | + Route::bind('module', function($value) { |
|
| 29 | 29 | return Module::where('name', $value)->first() ?? abort(404); |
| 30 | 30 | }); |
| 31 | 31 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Uccello\Core\Support\Traits; |
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Builder ; |
|
| 5 | +use Illuminate\Database\Eloquent\Builder; |
|
| 6 | 6 | use Illuminate\Support\Collection; |
| 7 | 7 | use Uccello\Core\Models\Relatedlist; |
| 8 | 8 | use Uccello\Core\Models\Relation; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | // Retrieve all related records and add the relation id to be able to delete the relation instead of the record |
| 90 | 90 | $relatedRecords = new Collection(); |
| 91 | - foreach($relations as $relation) |
|
| 91 | + foreach ($relations as $relation) |
|
| 92 | 92 | { |
| 93 | 93 | $relatedRecord = $relatedModel::find($relation->related_record_id); |
| 94 | 94 | $relatedRecord->relation_id = $relation->id; // Add relation id |
| 95 | - $relatedRecords[] = $relatedRecord; |
|
| 95 | + $relatedRecords[ ] = $relatedRecord; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $relatedRecords; |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | protected function generateTabsBlocksFieldsStructure(Module $module) { |
| 142 | 142 | if (empty($this->structure->tabs)) { |
| 143 | - $this->structure->tabs = []; |
|
| 143 | + $this->structure->tabs = [ ]; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $defaultFilter = $module->filters->where('name', 'filter.all')->first(); |
| 147 | 147 | |
| 148 | 148 | foreach ($module->tabs as $tab) { |
| 149 | 149 | $_tab = new \StdClass(); |
| 150 | - $_tab->blocks = []; |
|
| 150 | + $_tab->blocks = [ ]; |
|
| 151 | 151 | $_tab->id = $tab->id; |
| 152 | 152 | $_tab->label = $tab->label; |
| 153 | 153 | $_tab->icon = $tab->icon; |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | foreach ($tab->blocks as $block) { |
| 158 | 158 | $_block = new \StdClass(); |
| 159 | - $_block->fields = []; |
|
| 159 | + $_block->fields = [ ]; |
|
| 160 | 160 | $_block->id = $block->id; |
| 161 | 161 | $_block->label = $block->label; |
| 162 | 162 | $_block->icon = $block->icon; |
| 163 | 163 | $_block->sequence = $block->sequence; |
| 164 | 164 | $_block->data = $block->data; |
| 165 | 165 | |
| 166 | - $_tab->blocks[] = $_block; |
|
| 166 | + $_tab->blocks[ ] = $_block; |
|
| 167 | 167 | |
| 168 | 168 | foreach ($block->fields as $field) { |
| 169 | 169 | $_field = new \StdClass(); |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | $_field->data = $field->data; |
| 176 | 176 | $_field->displayInFilter = !empty($defaultFilter) ? in_array($field->name, $defaultFilter->columns) : false; |
| 177 | 177 | |
| 178 | - $_block->fields[] = $_field; |
|
| 178 | + $_block->fields[ ] = $_field; |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $this->structure->tabs[] = $_tab; |
|
| 182 | + $this->structure->tabs[ ] = $_tab; |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | protected function generateRelatedListsStructure(Module $module) { |
| 193 | 193 | if (empty($this->structure->relatedlists)) { |
| 194 | - $this->structure->relatedlists = []; |
|
| 194 | + $this->structure->relatedlists = [ ]; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | foreach ($module->relatedlists as $relatedlist) { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $_relatedlist->sequence = $relatedlist->sequence; |
| 209 | 209 | $_relatedlist->data = $relatedlist->data; |
| 210 | 210 | |
| 211 | - $this->structure->relatedlists[] = $_relatedlist; |
|
| 211 | + $this->structure->relatedlists[ ] = $_relatedlist; |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | protected function generateLinksStructure(Module $module) { |
| 222 | 222 | if (empty($this->structure->links)) { |
| 223 | - $this->structure->links = []; |
|
| 223 | + $this->structure->links = [ ]; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | foreach ($module->links as $link) { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $_link->sequence = $link->sequence; |
| 234 | 234 | $_link->data = $link->data; |
| 235 | 235 | |
| 236 | - $this->structure->links[] = $_link; |
|
| 236 | + $this->structure->links[ ] = $_link; |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -249,12 +249,12 @@ discard block |
||
| 249 | 249 | $this->structure->lang = new \StdClass(); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - if (!$this->files->exists($this->filePath . 'resources/lang')) { |
|
| 252 | + if (!$this->files->exists($this->filePath.'resources/lang')) { |
|
| 253 | 253 | return; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Retrieve all languages (one directory represents one language) |
| 257 | - $languageDirectories = $this->files->directories($this->filePath . 'resources/lang'); |
|
| 257 | + $languageDirectories = $this->files->directories($this->filePath.'resources/lang'); |
|
| 258 | 258 | |
| 259 | 259 | foreach ($languageDirectories as $languageDirectory) { |
| 260 | 260 | $lang = $this->files->basename($languageDirectory); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $this->structure->lang->{$lang} = new \StdClass(); |
| 263 | 263 | |
| 264 | 264 | // Get module translations |
| 265 | - $moduleTranslationFile = $this->filePath . 'resources/lang/' . $lang . '/' . $this->structure->name . '.php'; |
|
| 265 | + $moduleTranslationFile = $this->filePath.'resources/lang/'.$lang.'/'.$this->structure->name.'.php'; |
|
| 266 | 266 | |
| 267 | 267 | if ($this->files->exists($moduleTranslationFile)) { |
| 268 | 268 | $translations = $this->files->getRequire($moduleTranslationFile); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $packageParts = explode('/', $module->data->package); |
| 290 | 290 | |
| 291 | 291 | if (count($packageParts) === 2) { |
| 292 | - $this->filePath = 'packages/' . $packageParts[0] . '/' . $packageParts[1] . '/'; |
|
| 292 | + $this->filePath = 'packages/'.$packageParts[ 0 ].'/'.$packageParts[ 1 ].'/'; |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @var array |
| 52 | 52 | */ |
| 53 | - protected $fieldsToDelete = []; |
|
| 53 | + protected $fieldsToDelete = [ ]; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Constructor |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $packageParts = explode('/', $this->structure->data->package); |
| 124 | 124 | |
| 125 | 125 | if (count($packageParts) === 2) { |
| 126 | - $this->filePath = 'packages/' . $packageParts[0] . '/' . $packageParts[1] . '/'; |
|
| 126 | + $this->filePath = 'packages/'.$packageParts[ 0 ].'/'.$packageParts[ 1 ].'/'; |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $statusMessage = 'was created.'; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - $this->command->line('The module <info>' . $module->name . '</info> '. $statusMessage); |
|
| 202 | + $this->command->line('The module <info>'.$module->name.'</info> '.$statusMessage); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | return $module; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | if (!$found) { |
| 308 | 308 | $field->delete(); |
| 309 | - $this->fieldsToDelete[] = $field; |
|
| 309 | + $this->fieldsToDelete[ ] = $field; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | } |
@@ -369,11 +369,11 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | protected function createTable(Module $module) |
| 371 | 371 | { |
| 372 | - $tableName = $this->structure->tablePrefix . $this->structure->tableName; |
|
| 372 | + $tableName = $this->structure->tablePrefix.$this->structure->tableName; |
|
| 373 | 373 | |
| 374 | 374 | if (!Schema::hasTable($tableName)) { |
| 375 | 375 | // Create table |
| 376 | - Schema::create($tableName, function (Blueprint $table) use ($module) { |
|
| 376 | + Schema::create($tableName, function(Blueprint $table) use ($module) { |
|
| 377 | 377 | $table->increments('id'); |
| 378 | 378 | |
| 379 | 379 | // Create each column according to the selected uitype |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | continue; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - if (!empty((array) $_field->data)) { |
|
| 391 | + if (!empty((array)$_field->data)) { |
|
| 392 | 392 | $data = $_field->data; |
| 393 | 393 | } else { |
| 394 | 394 | $data = null; |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | }); |
| 417 | 417 | |
| 418 | 418 | if (!is_null($this->command)) { |
| 419 | - $this->command->line('The table <info>' . $tableName . '</info> was created.'); |
|
| 419 | + $this->command->line('The table <info>'.$tableName.'</info> was created.'); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | } else { |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | continue; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - if (!empty((array) $_field->data)) { |
|
| 437 | + if (!empty((array)$_field->data)) { |
|
| 438 | 438 | $data = $_field->data; |
| 439 | 439 | } else { |
| 440 | 440 | $data = null; |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | }); |
| 480 | 480 | |
| 481 | 481 | if (!is_null($this->command)) { |
| 482 | - $this->command->line('The table <info>' . $tableName . '</info> already exists. It was <comment>updated</comment>.'); |
|
| 482 | + $this->command->line('The table <info>'.$tableName.'</info> already exists. It was <comment>updated</comment>.'); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | protected function createColumn(Field $field, Blueprint $table, bool $updateColumn = false) |
| 496 | 496 | { |
| 497 | - $tableName = $this->structure->tablePrefix . $this->structure->tableName; |
|
| 497 | + $tableName = $this->structure->tablePrefix.$this->structure->tableName; |
|
| 498 | 498 | |
| 499 | 499 | // Create column |
| 500 | 500 | $column = uitype($field->uitype->id)->createFieldColumn($field, $table); |
@@ -529,10 +529,10 @@ discard block |
||
| 529 | 529 | protected function createDefaultFilter(Module $module) |
| 530 | 530 | { |
| 531 | 531 | // Add all field in the filter |
| 532 | - $columns = []; |
|
| 532 | + $columns = [ ]; |
|
| 533 | 533 | foreach ($this->getAllFields() as $field) { |
| 534 | 534 | if ($field->displayInFilter === true) { |
| 535 | - $columns[] = $field->name; |
|
| 535 | + $columns[ ] = $field->name; |
|
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | { |
| 630 | 630 | $domains = Domain::all(); |
| 631 | 631 | |
| 632 | - foreach($domains as $domain) { |
|
| 632 | + foreach ($domains as $domain) { |
|
| 633 | 633 | $domain->modules()->detach($module); // Useful if it exists yet |
| 634 | 634 | $domain->modules()->attach($module); |
| 635 | 635 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | { |
| 646 | 646 | foreach ($this->structure->lang as $locale => $translations) { |
| 647 | 647 | |
| 648 | - $languageFile = $this->filePath . 'resources/lang/' . $locale . '/' . $this->structure->name . '.php'; |
|
| 648 | + $languageFile = $this->filePath.'resources/lang/'.$locale.'/'.$this->structure->name.'.php'; |
|
| 649 | 649 | |
| 650 | 650 | // If file exists then update translations |
| 651 | 651 | if ($this->files->exists($languageFile)) { |
@@ -654,11 +654,11 @@ discard block |
||
| 654 | 654 | $fileTranslations = $this->files->getRequire($languageFile); |
| 655 | 655 | |
| 656 | 656 | // Add or update translations ($translations have priority) |
| 657 | - $translations = array_merge($fileTranslations, (array) $translations); |
|
| 657 | + $translations = array_merge($fileTranslations, (array)$translations); |
|
| 658 | 658 | |
| 659 | - $message = 'The file <info>' . $languageFile . '</info> already exists. It was <comment>updated</comment>.'; |
|
| 659 | + $message = 'The file <info>'.$languageFile.'</info> already exists. It was <comment>updated</comment>.'; |
|
| 660 | 660 | } else { |
| 661 | - $message = 'The file <info>' . $languageFile . '</info> was created.'; |
|
| 661 | + $message = 'The file <info>'.$languageFile.'</info> was created.'; |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | // Write language file |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | continue; |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | - $content .= " '$label' => '". str_replace("'", "\'", $translation) ."',\n"; |
|
| 691 | + $content .= " '$label' => '".str_replace("'", "\'", $translation)."',\n"; |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | $content .= "];"; |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | // Check model stub file existence (from module-designer package) |
| 714 | 714 | $stubsDirectory = base_path('vendor/uccello/module-designer/app/Console/Commands/stubs'); |
| 715 | 715 | |
| 716 | - if (!$this->files->exists($stubsDirectory . '/model.stub')) { |
|
| 716 | + if (!$this->files->exists($stubsDirectory.'/model.stub')) { |
|
| 717 | 717 | if (!is_null($this->command)) { |
| 718 | 718 | $this->command->line('<error>You have to install module-designer to generate the model file</error> : <comment>composer require uccello/module-designer</comment>'); |
| 719 | 719 | } |
@@ -738,8 +738,8 @@ discard block |
||
| 738 | 738 | $subDirectories = implode('/', $modelClassData); |
| 739 | 739 | |
| 740 | 740 | // Create sub directories if not exist |
| 741 | - if (!$this->files->isDirectory($this->filePath . '/app/' . $subDirectories)) { |
|
| 742 | - $this->files->makeDirectory($this->filePath . '/app/' . $subDirectories, 0755, true); // Recursive |
|
| 741 | + if (!$this->files->isDirectory($this->filePath.'/app/'.$subDirectories)) { |
|
| 742 | + $this->files->makeDirectory($this->filePath.'/app/'.$subDirectories, 0755, true); // Recursive |
|
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | $subDirectories .= '/'; |
@@ -752,15 +752,15 @@ discard block |
||
| 752 | 752 | $tablePrefix = $this->structure->tablePrefix; |
| 753 | 753 | |
| 754 | 754 | // File path |
| 755 | - $modelFile = $this->filePath . 'app/' . $subDirectories . $className . '.php'; |
|
| 755 | + $modelFile = $this->filePath.'app/'.$subDirectories.$className.'.php'; |
|
| 756 | 756 | |
| 757 | 757 | // Check if file already exists |
| 758 | 758 | if ($this->files->exists($modelFile)) { |
| 759 | 759 | if (!is_null($this->command)) { |
| 760 | 760 | $modelFileCopy = str_replace('.php', '.prev.php', $modelFile); |
| 761 | 761 | $this->files->move($modelFile, $modelFileCopy); |
| 762 | - $this->command->line('<error>WARNING:</error> The file <info>' . $modelFile . '</info> already exists. '. |
|
| 763 | - 'It was <comment>renamed</comment> into <info>' . $this->files->basename($modelFileCopy). '</info>.' |
|
| 762 | + $this->command->line('<error>WARNING:</error> The file <info>'.$modelFile.'</info> already exists. '. |
|
| 763 | + 'It was <comment>renamed</comment> into <info>'.$this->files->basename($modelFileCopy).'</info>.' |
|
| 764 | 764 | ); |
| 765 | 765 | } |
| 766 | 766 | } |
@@ -782,16 +782,16 @@ discard block |
||
| 782 | 782 | $relatedModule = Module::where('name', $field->data->module)->first(); |
| 783 | 783 | |
| 784 | 784 | if ($relatedModule) { |
| 785 | - $relations .= "\n public function ". $field->name . "()\n". |
|
| 785 | + $relations .= "\n public function ".$field->name."()\n". |
|
| 786 | 786 | " {\n". |
| 787 | - " return \$this->belongsTo(\\". $relatedModule->model_class . "::class);\n". |
|
| 787 | + " return \$this->belongsTo(\\".$relatedModule->model_class."::class);\n". |
|
| 788 | 788 | " }\n"; |
| 789 | 789 | } |
| 790 | 790 | } |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | // Generate content |
| 794 | - $fileContent = $this->files->get($stubsDirectory . '/model.stub'); |
|
| 794 | + $fileContent = $this->files->get($stubsDirectory.'/model.stub'); |
|
| 795 | 795 | |
| 796 | 796 | $content = str_replace( |
| 797 | 797 | [ |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $this->files->put($modelFile, $content); |
| 815 | 815 | |
| 816 | 816 | if (!is_null($this->command)) { |
| 817 | - $this->command->line('The file <info>' . $modelFile . '</info> was created.'); |
|
| 817 | + $this->command->line('The file <info>'.$modelFile.'</info> was created.'); |
|
| 818 | 818 | } |
| 819 | 819 | } |
| 820 | 820 | |
@@ -841,14 +841,14 @@ discard block |
||
| 841 | 841 | */ |
| 842 | 842 | protected function getAllFields() |
| 843 | 843 | { |
| 844 | - $fields = []; |
|
| 844 | + $fields = [ ]; |
|
| 845 | 845 | |
| 846 | 846 | if (isset($this->structure->tabs)) { |
| 847 | 847 | foreach ($this->structure->tabs as $tab) { |
| 848 | 848 | foreach ($tab->blocks as $block) { |
| 849 | 849 | if (isset($block->fields)) { |
| 850 | 850 | foreach ($block->fields as $field) { |
| 851 | - $fields[] = $field; |
|
| 851 | + $fields[ ] = $field; |
|
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | } |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // If it is a N-1 related list, add value of the linked field |
| 84 | 84 | if ($this->type === 'n-1') { |
| 85 | - $params[$this->relatedField->name] = $sourceRecordId; |
|
| 85 | + $params[ $this->relatedField->name ] = $sourceRecordId; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Add tab id if defined |
| 89 | 89 | if ($this->tab_id) { |
| 90 | - $params['tab'] = $this->tab_id; |
|
| 90 | + $params[ 'tab' ] = $this->tab_id; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return ucroute('uccello.edit', $domain, $this->relatedModule, $params); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // Add tab id if defined |
| 113 | 113 | if ($this->tab_id) { |
| 114 | - $params['tab'] = $this->tab_id; |
|
| 114 | + $params[ 'tab' ] = $this->tab_id; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | return ucroute('uccello.edit', $domain, $this->relatedModule, $params); |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // Add tab id if defined |
| 138 | 138 | if ($this->tab_id) { |
| 139 | - $params['tab'] = $this->tab_id; |
|
| 139 | + $params[ 'tab' ] = $this->tab_id; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // If it is a N-N related list and if necessary add the relation id. It will delete the relation instead of the record |
| 143 | 143 | if ($this->type === 'n-n' && $preferDeleteRelation === true) { |
| 144 | - $params['relation_id'] = 'RELATION_ID'; // RELATION_ID will be replaced automaticaly by the relation id in the datatable |
|
| 144 | + $params[ 'relation_id' ] = 'RELATION_ID'; // RELATION_ID will be replaced automaticaly by the relation id in the datatable |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return ucroute('uccello.delete', $domain, $this->relatedModule, $params); |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public function getLabelAttribute() : string |
| 72 | 72 | { |
| 73 | - return $this->data->label ?? 'field.' . $this->name; |
|
| 73 | + return $this->data->label ?? 'field.'.$this->name; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @var array |
| 24 | 24 | */ |
| 25 | - protected $dates = ['deleted_at']; |
|
| 25 | + protected $dates = [ 'deleted_at' ]; |
|
| 26 | 26 | |
| 27 | 27 | protected function initTablePrefix() |
| 28 | 28 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function roles() |
| 38 | 38 | { |
| 39 | - return $this->belongsToMany(Role::class, $this->tablePrefix . 'profiles_roles'); |
|
| 39 | + return $this->belongsToMany(Role::class, $this->tablePrefix.'profiles_roles'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function permissions() |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $permissions = $this->permissions->where('module_id', $module->id); |
| 69 | 69 | |
| 70 | 70 | foreach ($permissions as $permission) { |
| 71 | - $capabilities[] = $permission->capability; |
|
| 71 | + $capabilities[ ] = $permission->capability; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $capabilities->unique(); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function domains() |
| 48 | 48 | { |
| 49 | - return $this->belongsToMany(Domain::class, $this->tablePrefix . 'domains_modules'); |
|
| 49 | + return $this->belongsToMany(Domain::class, $this->tablePrefix.'domains_modules'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function tabs() |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getMenuLinksAttribute() : array |
| 117 | 117 | { |
| 118 | - $menuLinks = []; |
|
| 118 | + $menuLinks = [ ]; |
|
| 119 | 119 | |
| 120 | 120 | //TODO: Adds capability needed |
| 121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $link->label = $this->name; |
| 127 | 127 | $link->route = $this->data->menu; |
| 128 | 128 | $link->icon = $this->icon; |
| 129 | - $menuLinks[] = $link; |
|
| 129 | + $menuLinks[ ] = $link; |
|
| 130 | 130 | } |
| 131 | 131 | // Several routes |
| 132 | 132 | elseif (is_array($this->data->menu)) { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | if (empty($link->icon)) { |
| 135 | 135 | $link->icon = $this->icon; |
| 136 | 136 | } |
| 137 | - $menuLinks[] = $link; |
|
| 137 | + $menuLinks[ ] = $link; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | // No route wanted |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $link->label = $this->name; |
| 149 | 149 | $link->route = 'uccello.list'; |
| 150 | 150 | $link->icon = $this->icon; |
| 151 | - $menuLinks[] = $link; |
|
| 151 | + $menuLinks[ ] = $link; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | return $menuLinks; |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * @param Module|null $module |
| 64 | 64 | * @return string|null |
| 65 | 65 | */ |
| 66 | - public function getFormattedValueToSave(Request $request, Field $field, $value, $record=null, ?Domain $domain=null, ?Module $module=null) : ?string |
|
| 66 | + public function getFormattedValueToSave(Request $request, Field $field, $value, $record = null, ?Domain $domain = null, ?Module $module = null) : ?string |
|
| 67 | 67 | { |
| 68 | 68 | $uitypeClass = $this->class; |
| 69 | 69 | return (new $uitypeClass())->getFormattedValueToSave($request, $field, $value, $record, $domain, $module); |