10
10
class InstallDatabaseManager extends Command
11
11
{
12
12
/**
13
- * The name and signature of the console command.
13
+ * The console command name .
14
14
*
15
15
* @var string
16
16
*/
17
- protected $ signature = 'dbm:install {mongodb?} {--force=} ' ;
17
+ protected $ name = 'dbm:install ' ;
18
18
/**
19
19
* The console command description.
20
20
*
@@ -62,32 +62,23 @@ 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
- }
72
65
$ this ->info ('Publishing the Database Manager assets, database, and config files ' );
73
66
// Publish only relevant resources on install
74
67
$ tags = ['dbm.config ' ];
75
68
$ 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
+
85
70
$ this ->info ('Migrating the database tables into your application ' );
86
71
$ this ->call ('migrate ' , ['--force ' => $ this ->option ('force ' )]);
87
- // Install laravel passport
88
72
$ this ->info ('Install Passport ' );
89
73
$ 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'
91
82
$ this ->info ('Adding Database Manager routes ' );
92
83
$ web_routes_contents = $ filesystem ->get (base_path ('routes/web.php ' ));
93
84
$ api_routes_contents = $ filesystem ->get (base_path ('routes/api.php ' ));
@@ -103,14 +94,16 @@ public function handle(Filesystem $filesystem)
103
94
"\n\nDBM::apiRoutes(); \n"
104
95
);
105
96
}
106
- // Database seeder
97
+
107
98
$ this ->info ('Seeding... ' );
99
+ // Seeding Dummy Data
108
100
$ class = 'DatabaseManagerSeeder ' ;
109
101
$ file = $ this ->seedersPath . $ class . '.php ' ;
110
102
if (file_exists ($ file ) && !class_exists ($ class )) {
111
103
require_once $ file ;
112
104
}
113
105
with (new $ class ())->run ();
106
+
114
107
$ this ->info ('Seeding Completed ' );
115
108
}
116
109
}
0 commit comments