@@ -73,6 +73,7 @@ public function installAuth()
73
73
$ this ->ensureDirectoriesExist ($ viewsPath );
74
74
75
75
$ this ->scaffoldAuth ();
76
+ $ this ->scaffoldController ();
76
77
}
77
78
78
79
protected function ensureDirectoriesExist ($ viewsPath )
@@ -90,6 +91,23 @@ protected function ensureDirectoriesExist($viewsPath)
90
91
}
91
92
}
92
93
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
+
93
111
protected function scaffoldAuth ()
94
112
{
95
113
file_put_contents (app_path ('Http/Controllers/HomeController.php ' ), $ this ->compileHomeControllerStub ());
@@ -105,6 +123,14 @@ protected function scaffoldAuth()
105
123
$ filesystem ->copyDirectory (__DIR__ .'/../coreui-stubs/auth ' , resource_path ('views/auth ' ));
106
124
$ filesystem ->copyDirectory (__DIR__ .'/../coreui-stubs/layouts ' , resource_path ('views/layouts ' ));
107
125
$ 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
+ });
108
134
});
109
135
}
110
136
0 commit comments