5
5
use Illuminate \Filesystem \Filesystem ;
6
6
use Illuminate \Foundation \Console \Presets \Preset ;
7
7
8
- class NowUIPreset extends Preset
8
+ class NowUiPreset extends Preset
9
9
{
10
- const STUBSPATH = __DIR__ .'/nowui -stubs/ ' ;
10
+ const STUBSPATH = __DIR__ .'/now-ui -stubs/ ' ;
11
11
12
12
/**
13
13
* Install the preset.
@@ -16,15 +16,17 @@ class NowUIPreset extends Preset
16
16
*/
17
17
public static function install ()
18
18
{
19
- static ::updatePackages ();
20
- static ::updateAssets ();
19
+ static ::updatePackages ();
20
+ static ::updateAssets ();
21
21
22
22
static ::updateWelcomePage ();
23
23
static ::updateAuthViews ();
24
24
static ::updateLayoutViews ();
25
25
static ::updateDashboardPage ();
26
26
27
27
static ::addUserManagement ();
28
+
29
+ static ::addAlerts ();
28
30
29
31
// static::removeNodeModules();
30
32
}
@@ -47,7 +49,7 @@ protected static function updatePackageArray(array $packages)
47
49
*/
48
50
protected static function updateAssets ()
49
51
{
50
- static ::copyDirectory ('resources/assets ' , public_path ('nowui ' ));
52
+ static ::copyDirectory ('resources/assets ' , public_path ('assets ' ));
51
53
}
52
54
53
55
/**
@@ -72,10 +74,10 @@ protected static function updateWelcomePage()
72
74
protected static function updateDashboardPage ()
73
75
{
74
76
// remove default welcome page
75
- static ::deleteResource (('views/dashboard .blade.php ' ));
77
+ static ::deleteResource (('views/home .blade.php ' ));
76
78
77
79
// copy new one from your stubs folder
78
- static ::copyFile ('resources/views/dashboard .blade.php ' , resource_path ('views/dashboard .blade.php ' ));
80
+ static ::copyFile ('resources/views/home .blade.php ' , resource_path ('views/home .blade.php ' ));
79
81
}
80
82
81
83
/**
@@ -87,6 +89,7 @@ protected static function updateLayoutViews()
87
89
{
88
90
// copy new one from your stubs folder
89
91
static ::copyDirectory ('resources/views/layouts ' , resource_path ('views/layouts ' ));
92
+ static ::copyDirectory ('resources/views/pages ' , resource_path ('views/pages ' ));
90
93
}
91
94
92
95
/**
@@ -98,19 +101,23 @@ protected static function updateAuthViews()
98
101
{
99
102
// Add Home controller
100
103
static ::copyFile ('app/Http/Controllers/HomeController.php ' , app_path ('Http/Controllers/HomeController.php ' ));
104
+ static ::copyFile ('app/Http/Controllers/PageController.php ' , app_path ('Http/Controllers/PageController.php ' ));
101
105
102
106
// Add Auth routes in 'routes/web.php'
103
107
file_put_contents (
104
- './routes/web.php ' ,
105
- "Auth::routes(); \n\nRoute::get('/home', 'HomeController@index')->name('home'); \n\n" ,
108
+ './routes/web.php ' ,
109
+ "Auth::routes(); \n\nRoute::get('/home', 'HomeController@index')->name('home'); \n\n" ,
106
110
FILE_APPEND
107
111
);
108
112
109
- // Copy argon auth views from the stubs folder
113
+ // Copy now-ui auth views from the stubs folder
110
114
static ::deleteResource ('views/home.blade.php ' );
111
115
static ::copyDirectory ('resources/views/auth ' , resource_path ('views/auth ' ));
112
116
}
113
-
117
+ public static function addAlerts ()
118
+ {
119
+ static ::copyDirectory ('resources/views/alerts ' , resource_path ('views/alerts ' ));
120
+ }
114
121
/**
115
122
* Copy user management and profile edit files
116
123
*
@@ -120,6 +127,7 @@ public static function addUserManagement()
120
127
{
121
128
// Add seeder, controllers, requests and rules
122
129
static ::copyDirectory ('database/seeds ' , app_path ('../database/seeds ' ));
130
+ static ::copyDirectory ('database/factories ' , app_path ('../database/factories ' ));
123
131
124
132
static ::copyFile ('app/Http/Controllers/UserController.php ' , app_path ('Http/Controllers/UserController.php ' ));
125
133
static ::copyFile ('app/Http/Controllers/ProfileController.php ' , app_path ('Http/Controllers/ProfileController.php ' ));
@@ -128,8 +136,8 @@ public static function addUserManagement()
128
136
129
137
// Add routes
130
138
file_put_contents (
131
- './routes/web.php ' ,
132
- "Route::group(['middleware' => 'auth'], function () { \n\tRoute::resource('user', 'UserController', ['except' => ['show']]); \n\tRoute::get('profile', ['as' => 'profile.edit', 'uses' => 'ProfileController@edit']); \n\tRoute::put('profile', ['as' => 'profile.update', 'uses' => 'ProfileController@update']); \n\tRoute::put('profile/password', ['as' => 'profile.password', 'uses' => 'ProfileController@password']); \n} ); \n\n" ,
139
+ './routes/web.php ' ,
140
+ "Route::group(['middleware' => 'auth'], function () { \n\tRoute::resource('user', 'UserController', ['except' => ['show']]); \n\tRoute::get('profile', ['as' => 'profile.edit', 'uses' => 'ProfileController@edit']); \n\tRoute::put('profile', ['as' => 'profile.update', 'uses' => 'ProfileController@update']); \n\tRoute::put('profile/password', ['as' => 'profile.password', 'uses' => 'ProfileController@password']); \n\t Route::get('{page}', ['as' => 'page.index', 'uses' => 'PageController@index'] ); \n}); \n\n" ,
133
141
FILE_APPEND
134
142
);
135
143
0 commit comments