@@ -9,29 +9,29 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class EventServiceProvider extends DefaultEventServiceProvider |
| 11 | 11 | { |
| 12 | - /** |
|
| 12 | + /** |
|
| 13 | 13 | * The event listener mappings for the application. |
| 14 | 14 | * |
| 15 | 15 | * @var array |
| 16 | 16 | */ |
| 17 | 17 | protected $listen = [ |
| 18 | - 'Uccello\Core\Events\AfterSaveEvent' => [ |
|
| 19 | - 'Uccello\Core\Listeners\Profile\AfterSaveEventListener', |
|
| 20 | - 'Uccello\Core\Listeners\Role\AfterSaveEventListener', |
|
| 21 | - 'Uccello\Core\Listeners\User\AfterSaveEventListener', |
|
| 22 | - 'Uccello\Core\Listeners\Domain\AfterSaveEventListener', |
|
| 23 | - ], |
|
| 24 | - ]; |
|
| 18 | + 'Uccello\Core\Events\AfterSaveEvent' => [ |
|
| 19 | + 'Uccello\Core\Listeners\Profile\AfterSaveEventListener', |
|
| 20 | + 'Uccello\Core\Listeners\Role\AfterSaveEventListener', |
|
| 21 | + 'Uccello\Core\Listeners\User\AfterSaveEventListener', |
|
| 22 | + 'Uccello\Core\Listeners\Domain\AfterSaveEventListener', |
|
| 23 | + ], |
|
| 24 | + ]; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Register any events for your application. |
|
| 28 | - * |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function boot() |
|
| 32 | - { |
|
| 33 | - parent::boot(); |
|
| 26 | + /** |
|
| 27 | + * Register any events for your application. |
|
| 28 | + * |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function boot() |
|
| 32 | + { |
|
| 33 | + parent::boot(); |
|
| 34 | 34 | |
| 35 | - // |
|
| 36 | - } |
|
| 35 | + // |
|
| 36 | + } |
|
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -12,34 +12,34 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class AppServiceProvider extends ServiceProvider |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Indicates if loading of the provider is deferred. |
|
| 17 | - * |
|
| 18 | - * @var bool |
|
| 19 | - */ |
|
| 20 | - protected $defer = false; |
|
| 15 | + /** |
|
| 16 | + * Indicates if loading of the provider is deferred. |
|
| 17 | + * |
|
| 18 | + * @var bool |
|
| 19 | + */ |
|
| 20 | + protected $defer = false; |
|
| 21 | 21 | |
| 22 | - public function boot() |
|
| 23 | - { |
|
| 22 | + public function boot() |
|
| 23 | + { |
|
| 24 | 24 | // For compatibility |
| 25 | 25 | Schema::defaultStringLength(191); |
| 26 | 26 | |
| 27 | 27 | // Config |
| 28 | 28 | $this->publishes([ |
| 29 | - __DIR__ . '/../../config/uccello.php' => config_path('uccello.php'), |
|
| 29 | + __DIR__ . '/../../config/uccello.php' => config_path('uccello.php'), |
|
| 30 | 30 | ], 'config'); |
| 31 | 31 | |
| 32 | 32 | // Views |
| 33 | 33 | $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'uccello'); |
| 34 | 34 | $this->publishes([ |
| 35 | - __DIR__ . '/../../resources/views' => resource_path('views/vendor/uccello') |
|
| 35 | + __DIR__ . '/../../resources/views' => resource_path('views/vendor/uccello') |
|
| 36 | 36 | ], 'views'); |
| 37 | 37 | |
| 38 | 38 | // Publish assets |
| 39 | 39 | $this->publishes([ |
| 40 | - __DIR__ . '/../../public' => public_path('vendor/uccello/uccello'), |
|
| 41 | - __DIR__ . '/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
| 42 | - __DIR__ . '/../../public/images/vendor' => public_path('images/vendor') |
|
| 40 | + __DIR__ . '/../../public' => public_path('vendor/uccello/uccello'), |
|
| 41 | + __DIR__ . '/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
| 42 | + __DIR__ . '/../../public/images/vendor' => public_path('images/vendor') |
|
| 43 | 43 | ], 'assets'); |
| 44 | 44 | |
| 45 | 45 | // Translations |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | // Commands |
| 52 | 52 | if ($this->app->runningInConsole()) { |
| 53 | - $this->commands([ |
|
| 53 | + $this->commands([ |
|
| 54 | 54 | UccelloInstallCommand::class, |
| 55 | - ]); |
|
| 55 | + ]); |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | - } |
|
| 58 | 58 | |
| 59 | - public function register() |
|
| 60 | - { |
|
| 59 | + public function register() |
|
| 60 | + { |
|
| 61 | 61 | // Config |
| 62 | 62 | $this->mergeConfigFrom( |
| 63 | - __DIR__ . '/../../config/uccello.php', |
|
| 64 | - 'uccello' |
|
| 63 | + __DIR__ . '/../../config/uccello.php', |
|
| 64 | + 'uccello' |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | // Helper |
| 68 | 68 | App::bind('uccello', function () { |
| 69 | - return new \Uccello\Core\Helpers\Uccello; |
|
| 69 | + return new \Uccello\Core\Helpers\Uccello; |
|
| 70 | 70 | }); |
| 71 | - } |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -26,27 +26,27 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | // Config |
| 28 | 28 | $this->publishes([ |
| 29 | - __DIR__ . '/../../config/uccello.php' => config_path('uccello.php'), |
|
| 29 | + __DIR__.'/../../config/uccello.php' => config_path('uccello.php'), |
|
| 30 | 30 | ], 'config'); |
| 31 | 31 | |
| 32 | 32 | // Views |
| 33 | - $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'uccello'); |
|
| 33 | + $this->loadViewsFrom(__DIR__.'/../../resources/views', 'uccello'); |
|
| 34 | 34 | $this->publishes([ |
| 35 | - __DIR__ . '/../../resources/views' => resource_path('views/vendor/uccello') |
|
| 35 | + __DIR__.'/../../resources/views' => resource_path('views/vendor/uccello') |
|
| 36 | 36 | ], 'views'); |
| 37 | 37 | |
| 38 | 38 | // Publish assets |
| 39 | 39 | $this->publishes([ |
| 40 | - __DIR__ . '/../../public' => public_path('vendor/uccello/uccello'), |
|
| 41 | - __DIR__ . '/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
| 42 | - __DIR__ . '/../../public/images/vendor' => public_path('images/vendor') |
|
| 40 | + __DIR__.'/../../public' => public_path('vendor/uccello/uccello'), |
|
| 41 | + __DIR__.'/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
| 42 | + __DIR__.'/../../public/images/vendor' => public_path('images/vendor') |
|
| 43 | 43 | ], 'assets'); |
| 44 | 44 | |
| 45 | 45 | // Translations |
| 46 | - $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'uccello'); |
|
| 46 | + $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'uccello'); |
|
| 47 | 47 | |
| 48 | 48 | // Migrations |
| 49 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
|
| 49 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
| 50 | 50 | |
| 51 | 51 | // Commands |
| 52 | 52 | if ($this->app->runningInConsole()) { |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | // Config |
| 62 | 62 | $this->mergeConfigFrom( |
| 63 | - __DIR__ . '/../../config/uccello.php', |
|
| 63 | + __DIR__.'/../../config/uccello.php', |
|
| 64 | 64 | 'uccello' |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | // Helper |
| 68 | - App::bind('uccello', function () { |
|
| 68 | + App::bind('uccello', function() { |
|
| 69 | 69 | return new \Uccello\Core\Helpers\Uccello; |
| 70 | 70 | }); |
| 71 | 71 | } |
@@ -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 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Get the menu to display according to the environment (main or admin) |
| 81 | 81 | $domainMenu = $this->getDomainMenuToDisplay(); |
| 82 | 82 | |
| 83 | - $this->menuAccessibleModules = []; |
|
| 83 | + $this->menuAccessibleModules = [ ]; |
|
| 84 | 84 | |
| 85 | 85 | // If a menu was created, use it |
| 86 | 86 | if (!is_null($domainMenu)) { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | if (!empty($menuLink->module)) { |
| 197 | 197 | if (!in_array($menuLink->module, $this->menuAccessibleModules)) { |
| 198 | - $this->menuAccessibleModules[] = $menuLink->module; |
|
| 198 | + $this->menuAccessibleModules[ ] = $menuLink->module; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | // Link html |
| 247 | 247 | $link = Html::raw( |
| 248 | - '<a href="'. $url .'" class="'. $class .'">'. |
|
| 248 | + '<a href="'.$url.'" class="'.$class.'">'. |
|
| 249 | 249 | // (!$isInSubMenu ? '<i class="material-icons">'. $icon .'</i>' : ''). |
| 250 | 250 | // (!$isInSubMenu ? '<span>'. $label .'</span>' : $label). |
| 251 | - '<i class="material-icons">'. $icon .'</i>'. |
|
| 252 | - '<span>'. $label .'</span>'. |
|
| 251 | + '<i class="material-icons">'.$icon.'</i>'. |
|
| 252 | + '<span>'.$label.'</span>'. |
|
| 253 | 253 | '</a>' |
| 254 | 254 | )->setActive($isActive); |
| 255 | 255 | |
@@ -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 | /** |