@@ -73,6 +73,7 @@ public function installAuth()
7373 $ this ->ensureDirectoriesExist ($ viewsPath );
7474
7575 $ this ->scaffoldAuth ();
76+ $ this ->scaffoldController ();
7677 }
7778
7879 protected function ensureDirectoriesExist ($ viewsPath )
@@ -90,6 +91,23 @@ protected function ensureDirectoriesExist($viewsPath)
9091 }
9192 }
9293
94+ protected function scaffoldController ()
95+ {
96+ if (!is_dir ($ directory = app_path ('Http/Controllers/Auth ' ))) {
97+ mkdir ($ directory , 0755 , true );
98+ }
99+
100+ $ filesystem = new Filesystem ;
101+
102+ collect ($ filesystem ->allFiles (base_path ('vendor/laravel/ui/stubs/Auth ' )))
103+ ->each (function (SplFileInfo $ file ) use ($ filesystem ) {
104+ $ filesystem ->copy (
105+ $ file ->getPathname (),
106+ app_path ('Http/Controllers/Auth/ ' .Str::replaceLast ('.stub ' , '.php ' , $ file ->getFilename ()))
107+ );
108+ });
109+ }
110+
93111 protected function scaffoldAuth ()
94112 {
95113 file_put_contents (app_path ('Http/Controllers/HomeController.php ' ), $ this ->compileHomeControllerStub ());
@@ -105,6 +123,14 @@ protected function scaffoldAuth()
105123 $ filesystem ->copyDirectory (__DIR__ .'/../coreui-stubs/auth ' , resource_path ('views/auth ' ));
106124 $ filesystem ->copyDirectory (__DIR__ .'/../coreui-stubs/layouts ' , resource_path ('views/layouts ' ));
107125 $ filesystem ->copy (__DIR__ .'/../coreui-stubs/home.blade.php ' , resource_path ('views/home.blade.php ' ));
126+
127+ collect ($ filesystem ->allFiles (base_path ('vendor/laravel/ui/stubs/migrations ' )))
128+ ->each (function (SplFileInfo $ file ) use ($ filesystem ) {
129+ $ filesystem ->copy (
130+ $ file ->getPathname (),
131+ database_path ('migrations/ ' .$ file ->getFilename ())
132+ );
133+ });
108134 });
109135 }
110136
0 commit comments