File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ return [
4
+
5
+ 'enabled ' => env ('HOOKS_ENABLED ' , true ),
6
+
7
+ ];
Original file line number Diff line number Diff line change 6
6
use Illuminate \Filesystem \Filesystem ;
7
7
use Larapack \Hooks \Composer ;
8
8
use Larapack \Hooks \Events \Setup ;
9
+ use Larapack \Hooks \HooksServiceProvider ;
9
10
10
11
class SetupCommand extends Command
11
12
{
@@ -44,6 +45,8 @@ public function handle()
44
45
45
46
$ composer ->save ();
46
47
48
+ $ this ->call ('vendor:publish ' , ['--provider ' => HooksServiceProvider::class]);
49
+
47
50
$ this ->info ('Hooks are now ready to use! Go ahead and try to "php artisan hook:install test-hook" ' );
48
51
49
52
event (new Setup ());
Original file line number Diff line number Diff line change @@ -12,9 +12,22 @@ class HooksServiceProvider extends ServiceProvider
12
12
*/
13
13
public function register ()
14
14
{
15
+ $ configPath = dirname (__DIR__ ).'/publishable/config/hooks.php ' ;
16
+
17
+ $ this ->mergeConfigFrom ($ configPath , 'hooks ' );
18
+
19
+ if (!config ('hooks.enabled ' , true )) {
20
+ return ;
21
+ }
22
+
15
23
// Registers resources and commands
16
24
if ($ this ->app ->runningInConsole ()) {
17
25
$ this ->registerCommands ();
26
+
27
+ $ this ->publishes (
28
+ [$ configPath => config_path ('hooks.php ' )],
29
+ 'hooks-config '
30
+ );
18
31
}
19
32
20
33
// Register Hooks system and aliases
@@ -49,6 +62,10 @@ public function registerHookProviders()
49
62
*/
50
63
public function boot ()
51
64
{
65
+ if (!config ('hooks.enabled ' , true )) {
66
+ return ;
67
+ }
68
+
52
69
// Register hook providers
53
70
$ this ->registerHookProviders ();
54
71
}
You can’t perform that action at this time.
0 commit comments