|
10 | 10 | class InstallDatabaseManager extends Command |
11 | 11 | { |
12 | 12 | /** |
13 | | - * The console command name. |
| 13 | + * The name and signature of the console command. |
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | | - protected $name = 'dbm:install'; |
| 17 | + protected $signature = 'dbm:install {mongodb?} {--force=}'; |
18 | 18 | /** |
19 | 19 | * The console command description. |
20 | 20 | * |
@@ -62,25 +62,31 @@ protected function findComposer() |
62 | 62 | */ |
63 | 63 | public function handle(Filesystem $filesystem) |
64 | 64 | { |
| 65 | + $composer = $this->findComposer(); |
| 66 | + if ($this->argument('mongodb') == 'mongodb') { |
| 67 | + $this->info('Installing MongoDB package'); |
| 68 | + $process = new Process($composer . ' require jenssegers/mongodb'); |
| 69 | + $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
| 70 | + $process->setWorkingDirectory(base_path())->run(); |
| 71 | + } |
65 | 72 | $this->info('Publishing the Database Manager assets, database, and config files'); |
66 | 73 | // Publish only relevant resources on install |
67 | 74 | $tags = ['dbm.config']; |
68 | 75 | $this->call('vendor:publish', ['--provider' => ManagerServiceProvider::class, '--tag' => $tags]); |
69 | 76 | // Generate Storage Link |
70 | 77 | $this->info('Generate storage symblink'); |
71 | 78 | $this->call('storage:link'); |
| 79 | + // Dump autoload |
| 80 | + $this->info('Dumping the autoloaded files and reloading all new files'); |
| 81 | + $process = new Process($composer . ' dump-autoload'); |
| 82 | + $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
| 83 | + $process->setWorkingDirectory(base_path())->run(); |
72 | 84 | // Migrate database |
73 | 85 | $this->info('Migrating the database tables into your application'); |
74 | 86 | $this->call('migrate', ['--force' => $this->option('force')]); |
75 | 87 | // Install laravel passport |
76 | 88 | $this->info('Install Passport'); |
77 | 89 | $this->call('passport:install', ['--force' => $this->option('force')]); |
78 | | - // Dump autoload |
79 | | - $this->info('Dumping the autoloaded files and reloading all new files'); |
80 | | - $composer = $this->findComposer(); |
81 | | - $process = new Process($composer . ' dump-autoload'); |
82 | | - $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
83 | | - $process->setWorkingDirectory(base_path())->run(); |
84 | 90 | // Load Custom Database Manager routes |
85 | 91 | $this->info('Adding Database Manager routes'); |
86 | 92 | $web_routes_contents = $filesystem->get(base_path('routes/web.php')); |
|
0 commit comments