@@ -15,9 +15,12 @@ class AdminLTEPreset extends Preset
1515 /** @var Command */
1616 protected $ command ;
1717
18- public function __construct (Command $ command )
18+ public $ isFortify = false ;
19+
20+ public function __construct (Command $ command , $ isFortify = false )
1921 {
2022 $ this ->command = $ command ;
23+ $ this ->isFortify = $ isFortify ;
2124 }
2225
2326 /**
@@ -89,7 +92,10 @@ public function installAuth()
8992 $ this ->ensureDirectoriesExist ($ viewsPath );
9093
9194 $ this ->scaffoldAuth ();
92- $ this ->scaffoldController ();
95+
96+ if (!$ this ->isFortify ) {
97+ $ this ->scaffoldController ();
98+ }
9399 }
94100
95101 protected function ensureDirectoriesExist ($ viewsPath )
@@ -107,6 +113,24 @@ protected function ensureDirectoriesExist($viewsPath)
107113 }
108114 }
109115
116+ private function addAuthRoutes ()
117+ {
118+ file_put_contents (
119+ base_path ('routes/web.php ' ),
120+ "\nAuth::routes(); \n" ,
121+ FILE_APPEND
122+ );
123+ }
124+
125+ private function addHomeRoute ()
126+ {
127+ file_put_contents (
128+ base_path ('routes/web.php ' ),
129+ "\nRoute::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); \n" ,
130+ FILE_APPEND
131+ );
132+ }
133+
110134 protected function scaffoldController ()
111135 {
112136 if (!is_dir ($ directory = app_path ('Http/Controllers/Auth ' ))) {
@@ -128,11 +152,11 @@ protected function scaffoldAuth()
128152 {
129153 file_put_contents (app_path ('Http/Controllers/HomeController.php ' ), $ this ->compileHomeControllerStub ());
130154
131- file_put_contents (
132- base_path ( ' routes/web.php ' ),
133- " Auth::routes(); \n\n Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); \n\n" ,
134- FILE_APPEND
135- );
155+ $ this -> addHomeRoute ();
156+
157+ if (! $ this -> isFortify ) {
158+ $ this -> addAuthRoutes ();
159+ }
136160
137161 tap (new Filesystem (), function ($ filesystem ) {
138162 $ filesystem ->copyDirectory (__DIR__ .'/../adminlte-stubs/auth ' , resource_path ('views/auth ' ));
0 commit comments