File tree Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Laravel \Fortify \Console ;
4
+
5
+ use Illuminate \Console \Command ;
6
+ use Illuminate \Support \ServiceProvider ;
7
+ use Laravel \Fortify \FortifyServiceProvider ;
8
+
9
+ class InstallCommand extends Command
10
+ {
11
+ /**
12
+ * The name and signature of the console command.
13
+ *
14
+ * @var string
15
+ */
16
+ protected $ signature = 'fortify:install ' ;
17
+
18
+ /**
19
+ * The console command description.
20
+ *
21
+ * @var string
22
+ */
23
+ protected $ description = 'Install all of the Fortify resources ' ;
24
+
25
+ /**
26
+ * Execute the console command.
27
+ *
28
+ * @return void
29
+ */
30
+ public function handle ()
31
+ {
32
+ $ this ->callSilent ('vendor:publish ' , [
33
+ '--provider ' => FortifyServiceProvider::class,
34
+ ]);
35
+
36
+ $ this ->registerFortifyServiceProvider ();
37
+
38
+ $ this ->components ->info ('Fortify scaffolding installed successfully. ' );
39
+ }
40
+
41
+ /**
42
+ * Register the Fortify service provider in the application configuration file.
43
+ */
44
+ protected function registerFortifyServiceProvider (): void
45
+ {
46
+ if (! method_exists (ServiceProvider::class, 'addProviderToBootstrapFile ' )) {
47
+ return ;
48
+ }
49
+
50
+ ServiceProvider::addProviderToBootstrapFile (\App \Providers \FortifyServiceProvider::class);
51
+ }
52
+ }
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ public function boot()
113
113
{
114
114
$ this ->configurePublishing ();
115
115
$ this ->configureRoutes ();
116
+ $ this ->registerCommands ();
116
117
}
117
118
118
119
/**
@@ -161,4 +162,16 @@ protected function configureRoutes()
161
162
});
162
163
}
163
164
}
165
+
166
+ /**
167
+ * Register the package's commands.
168
+ */
169
+ protected function registerCommands (): void
170
+ {
171
+ if ($ this ->app ->runningInConsole ()) {
172
+ $ this ->commands ([
173
+ Console \InstallCommand::class,
174
+ ]);
175
+ }
176
+ }
164
177
}
You can’t perform that action at this time.
0 commit comments