Skip to content

Commit b55f3e6

Browse files
committed
Added MongoDB installation
1 parent 806d76b commit b55f3e6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/Commands/InstallDatabaseManager.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
class InstallDatabaseManager extends Command
1111
{
1212
/**
13-
* The console command name.
13+
* The name and signature of the console command.
1414
*
1515
* @var string
1616
*/
17-
protected $name = 'dbm:install';
17+
protected $signature = 'dbm:install {mongodb?} {--force=}';
1818
/**
1919
* The console command description.
2020
*
@@ -62,25 +62,31 @@ protected function findComposer()
6262
*/
6363
public function handle(Filesystem $filesystem)
6464
{
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+
}
6572
$this->info('Publishing the Database Manager assets, database, and config files');
6673
// Publish only relevant resources on install
6774
$tags = ['dbm.config'];
6875
$this->call('vendor:publish', ['--provider' => ManagerServiceProvider::class, '--tag' => $tags]);
6976
// Generate Storage Link
7077
$this->info('Generate storage symblink');
7178
$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();
7284
// Migrate database
7385
$this->info('Migrating the database tables into your application');
7486
$this->call('migrate', ['--force' => $this->option('force')]);
7587
// Install laravel passport
7688
$this->info('Install Passport');
7789
$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();
8490
// Load Custom Database Manager routes
8591
$this->info('Adding Database Manager routes');
8692
$web_routes_contents = $filesystem->get(base_path('routes/web.php'));

0 commit comments

Comments
 (0)