5
5
use Illuminate \Console \Command ;
6
6
use Illuminate \Container \Container ;
7
7
use Illuminate \Filesystem \Filesystem ;
8
- use Illuminate \Support \Str ;
9
8
use InfyOm \GeneratorHelpers \LaravelUtils ;
10
9
use Laravel \Ui \Presets \Preset ;
11
- use Symfony \Component \Finder \SplFileInfo ;
12
10
13
11
class CoreUIPreset extends Preset
14
12
{
@@ -29,11 +27,11 @@ public function __construct(Command $command)
29
27
protected static function updatePackageArray (array $ packages )
30
28
{
31
29
return [
32
- 'bootstrap ' => '^4.1.0 ' ,
33
- 'jquery ' => '^3.2 ' ,
34
- 'popper.js ' => '^1.12 ' ,
30
+ 'bootstrap ' => '^4.1.0 ' ,
31
+ 'jquery ' => '^3.2 ' ,
32
+ 'popper.js ' => '^1.12 ' ,
35
33
'@coreui/coreui ' => '^3.2.2 ' ,
36
- " @coreui/icons " => " ^1.0.1 " ,
34
+ ' @coreui/icons ' => ' ^1.0.1 ' ,
37
35
] + $ packages ;
38
36
}
39
37
@@ -73,7 +71,6 @@ public function installAuth()
73
71
$ this ->ensureDirectoriesExist ($ viewsPath );
74
72
75
73
$ this ->scaffoldAuth ();
76
- $ this ->scaffoldController ();
77
74
}
78
75
79
76
protected function ensureDirectoriesExist ($ viewsPath )
@@ -91,23 +88,6 @@ protected function ensureDirectoriesExist($viewsPath)
91
88
}
92
89
}
93
90
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
-
111
91
protected function scaffoldAuth ()
112
92
{
113
93
file_put_contents (app_path ('Http/Controllers/HomeController.php ' ), $ this ->compileHomeControllerStub ());
@@ -118,19 +98,11 @@ protected function scaffoldAuth()
118
98
FILE_APPEND
119
99
);
120
100
121
- tap (new Filesystem , function ($ filesystem ) {
101
+ tap (new Filesystem () , function ($ filesystem ) {
122
102
123
103
$ filesystem ->copyDirectory (__DIR__ .'/../coreui-stubs/auth ' , resource_path ('views/auth ' ));
124
104
$ filesystem ->copyDirectory (__DIR__ .'/../coreui-stubs/layouts ' , resource_path ('views/layouts ' ));
125
105
$ 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
- });
134
106
});
135
107
}
136
108
@@ -142,4 +114,4 @@ protected function compileHomeControllerStub()
142
114
file_get_contents (base_path ('vendor/laravel/ui/src/Auth/stubs/controllers/HomeController.stub ' ))
143
115
);
144
116
}
145
- }
117
+ }
0 commit comments