Conditions | 2 |
Paths | 2 |
Total Lines | 56 |
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 |
||
16 | public function boot() |
||
17 | { |
||
18 | /* |
||
19 | * Optional methods to load your package assets |
||
20 | */ |
||
21 | // $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'laravel-tickets'); |
||
22 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'laravel-tickets'); |
||
23 | $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
||
24 | |||
25 | if ($this->app->runningInConsole()) { |
||
26 | $this->publishes([ |
||
27 | __DIR__ . '/../config/config.php' => config_path('laravel-tickets.php'), |
||
28 | ], 'config'); |
||
29 | |||
30 | // Publishing the views. |
||
31 | $this->publishes([ |
||
32 | __DIR__ . '/../resources/views' => resource_path('views/vendor/laravel-tickets'), |
||
33 | ], 'views'); |
||
34 | |||
35 | $this->publishes([ |
||
36 | __DIR__ . '/../database/migrations' => database_path('migrations'), |
||
37 | ], 'migrations'); |
||
38 | |||
39 | // Publishing assets. |
||
40 | /*$this->publishes([ |
||
41 | __DIR__.'/../resources/assets' => public_path('vendor/laravel-tickets'), |
||
42 | ], 'assets');*/ |
||
43 | |||
44 | // Publishing the translation files. |
||
45 | // $this->publishes([ |
||
46 | // __DIR__ . '/../resources/lang' => resource_path('lang/vendor/laravel-tickets'), |
||
47 | // ], 'lang'); |
||
48 | |||
49 | // Registering package commands. |
||
50 | $this->commands([ AutoCloseCommand::class ]); |
||
51 | } |
||
52 | |||
53 | // Macro routing improved |
||
54 | Router::macro('ticketSystem', function () { |
||
55 | Route::middleware(config('laravel-tickets.guard'))->name('laravel-tickets.')->group(function () { |
||
56 | Route::prefix('/tickets')->group(function () { |
||
57 | Route::get('/', [ TicketController::class, 'index' ])->name('tickets.index'); |
||
58 | Route::post('/', [ TicketController::class, 'store' ])->name('tickets.store'); |
||
59 | Route::get('/create', [ TicketController::class, 'create' ])->name('tickets.create'); |
||
60 | Route::prefix('{ticket}')->group(function () { |
||
61 | Route::get('/', [ TicketController::class, 'show' ])->name('tickets.show'); |
||
62 | Route::post('/', [ TicketController::class, 'close' ])->name('tickets.close'); |
||
63 | Route::post('/message', [ TicketController::class, 'message' ])->name('tickets.message'); |
||
64 | Route::prefix('{ticketUpload}')->group(function () { |
||
65 | Route::get('/download', [ TicketController::class, 'download' ])->name('tickets.download'); |
||
66 | }); |
||
67 | }); |
||
68 | }); |
||
69 | }); |
||
70 | }); |
||
71 | } |
||
72 | |||
87 |