Conditions | 4 |
Paths | 4 |
Total Lines | 51 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
13 | public function boot() |
||
14 | { |
||
15 | /* |
||
16 | * Optional methods to load your package assets |
||
17 | */ |
||
18 | // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-smart-blog'); |
||
19 | |||
20 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-smart-blog'); |
||
21 | $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
||
22 | |||
23 | $this->app['router']->aliasMiddleware('admin', \DavideCasiraghi\LaravelSmartBlog\Http\Middleware\Admin::class); |
||
24 | |||
25 | if ($this->app->runningInConsole()) { |
||
26 | $this->publishes([ |
||
27 | __DIR__.'/../config/config.php' => config_path('laravel-smart-blog.php'), |
||
28 | ], 'config'); |
||
29 | |||
30 | // Publishing the views. |
||
31 | /*$this->publishes([ |
||
32 | __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-smart-blog'), |
||
33 | ], 'views');*/ |
||
34 | |||
35 | // Publishing assets. |
||
36 | /*$this->publishes([ |
||
37 | __DIR__.'/../resources/assets' => public_path('vendor/laravel-smart-blog'), |
||
38 | ], 'assets');*/ |
||
39 | |||
40 | // Publishing the translation files. |
||
41 | /*$this->publishes([ |
||
42 | __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-smart-blog'), |
||
43 | ], 'lang');*/ |
||
44 | |||
45 | // Registering package commands. |
||
46 | // $this->commands([]); |
||
47 | |||
48 | /* - Migrations - |
||
49 | create a migration instance for each .php.stub file eg. |
||
50 | create_continents_table.php.stub ---> 2019_04_28_190434761474_create_continents_table.php |
||
51 | */ |
||
52 | $migrations = [ |
||
53 | 'CreateCategoriesTable' => 'create_categories_table', |
||
54 | 'CreateCategoryTranslationsTable' => 'create_category_translations_table', |
||
55 | 'CreatePostsTable' => 'create_posts_table', |
||
56 | 'CreatePostTranslationsTable' => 'create_post_translations_table', |
||
57 | ]; |
||
58 | |||
59 | foreach ($migrations as $migrationFunctionName => $migrationFileName) { |
||
60 | if (! class_exists($migrationFunctionName)) { |
||
61 | $this->publishes([ |
||
62 | __DIR__.'/../database/migrations/'.$migrationFileName.'.php.stub' => database_path('migrations/'.Carbon::now()->format('Y_m_d_Hmsu').'_'.$migrationFileName.'.php'), |
||
63 | ], 'migrations'); |
||
64 | } |
||
83 |