1010class InstallDatabaseManager extends Command
1111{
1212 /**
13- * The name and signature of the console command.
13+ * The console command name .
1414 *
1515 * @var string
1616 */
17- protected $ signature = 'dbm:install {mongodb?} {--force=} ' ;
17+ protected $ name = 'dbm:install ' ;
1818 /**
1919 * The console command description.
2020 *
@@ -62,32 +62,23 @@ 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- }
7265 $ this ->info ('Publishing the Database Manager assets, database, and config files ' );
7366 // Publish only relevant resources on install
7467 $ tags = ['dbm.config ' ];
7568 $ this ->call ('vendor:publish ' , ['--provider ' => ManagerServiceProvider::class, '--tag ' => $ tags ]);
76- // Generate Storage Link
77- $ this ->info ('Generate storage symblink ' );
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 ();
84- // Migrate database
69+
8570 $ this ->info ('Migrating the database tables into your application ' );
8671 $ this ->call ('migrate ' , ['--force ' => $ this ->option ('force ' )]);
87- // Install laravel passport
8872 $ this ->info ('Install Passport ' );
8973 $ this ->call ('passport:install ' , ['--force ' => $ this ->option ('force ' )]);
90- // Load Custom Database Manager routes
74+
75+ $ this ->info ('Dumping the autoloaded files and reloading all new files ' );
76+ $ composer = $ this ->findComposer ();
77+ $ process = new Process ($ composer . ' dump-autoload ' );
78+ $ process ->setTimeout (null ); // Setting timeout to null to prevent installation from stopping at a certain point in time
79+ $ process ->setWorkingDirectory (base_path ())->run ();
80+
81+ // Load Custom Database Manager routes into application's 'routes/web.php'
9182 $ this ->info ('Adding Database Manager routes ' );
9283 $ web_routes_contents = $ filesystem ->get (base_path ('routes/web.php ' ));
9384 $ api_routes_contents = $ filesystem ->get (base_path ('routes/api.php ' ));
@@ -103,14 +94,16 @@ public function handle(Filesystem $filesystem)
10394 "\n\nDBM::apiRoutes(); \n"
10495 );
10596 }
106- // Database seeder
97+
10798 $ this ->info ('Seeding... ' );
99+ // Seeding Dummy Data
108100 $ class = 'DatabaseManagerSeeder ' ;
109101 $ file = $ this ->seedersPath . $ class . '.php ' ;
110102 if (file_exists ($ file ) && !class_exists ($ class )) {
111103 require_once $ file ;
112104 }
113105 with (new $ class ())->run ();
106+
114107 $ this ->info ('Seeding Completed ' );
115108 }
116109}
0 commit comments