| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Caffeinated\Modules\Providers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Illuminate\Support\ServiceProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | class ConsoleServiceProvider extends ServiceProvider | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |      * Bootstrap the application services. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 11 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |     public function boot() | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |         // | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      * Register the application services. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     public function register() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         $this->registerDisableCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         $this->registerEnableCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         $this->registerListCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         $this->registerMigrateCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $this->registerMigrateRefreshCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $this->registerMigrateResetCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $this->registerMigrateRollbackCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         $this->registerOptimizeCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         $this->registerSeedCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * Register the module:disable command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     protected function registerDisableCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         $this->app->singleton('command.module.disable', function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleDisableCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $this->commands('command.module.disable'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * Register the module:enable command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     protected function registerEnableCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $this->app->singleton('command.module.enable', function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleEnableCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->commands('command.module.enable'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * Register the module:list command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     protected function registerListCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $this->app->singleton('command.module.list', function ($app) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleListCommand($app['modules']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $this->commands('command.module.list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * Register the module:migrate command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     protected function registerMigrateCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         $this->app->singleton('command.module.migrate', function ($app) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleMigrateCommand($app['migrator'], $app['modules']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         $this->commands('command.module.migrate'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * Register the module:migrate:refresh command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     protected function registerMigrateRefreshCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $this->app->singleton('command.module.migrate.refresh', function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleMigrateRefreshCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         $this->commands('command.module.migrate.refresh'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |      * Register the module:migrate:reset command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     protected function registerMigrateResetCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         $this->app->singleton('command.module.migrate.reset', function ($app) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleMigrateResetCommand($app['modules'], $app['files'], $app['migrator']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         $this->commands('command.module.migrate.reset'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      * Register the module:migrate:rollback command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     protected function registerMigrateRollbackCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         $this->app->singleton('command.module.migrate.rollback', function ($app) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleMigrateRollbackCommand($app['modules']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         $this->commands('command.module.migrate.rollback'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      * Register the module:optimize command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     protected function registerOptimizeCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         $this->app->singleton('command.module.optimize', function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleOptimizeCommand(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $this->commands('command.module.optimize'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      * Register the module:seed command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     protected function registerSeedCommand() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |         $this->app->singleton('command.module.seed', function ($app) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |             return new \Caffeinated\Modules\Console\Commands\ModuleSeedCommand($app['modules']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         $this->commands('command.module.seed'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 140 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 141 |  |  |  |