@@ -26,7 +26,17 @@ public function register()
26
26
27
27
private function basePath (string $ path ): string
28
28
{
29
- return __DIR__ .'/.. ' .$ path ;
29
+ return __DIR__ . '/.. ' . $ path ;
30
+ }
31
+
32
+ /**
33
+ * Check if config is enabled
34
+ *
35
+ * @return bool
36
+ */
37
+ public function isEnabled (): bool
38
+ {
39
+ return (bool ) $ this ->app ['config ' ]->get ("{$ this ->name }.enabled " , true );
30
40
}
31
41
32
42
public function boot ()
@@ -41,6 +51,10 @@ public function boot()
41
51
$ this ->commands ([GenerateDummyLogsCommand::class]);
42
52
}
43
53
54
+ if (!$ this ->isEnabled ()) {
55
+ return ;
56
+ }
57
+
44
58
// registering routes
45
59
$ this ->loadRoutesFrom ($ this ->basePath ('/routes/web.php ' ));
46
60
@@ -54,19 +68,19 @@ public function boot()
54
68
LogViewer::clearFileCache ();
55
69
});
56
70
57
- if (! Gate::has ('downloadLogFile ' )) {
71
+ if (!Gate::has ('downloadLogFile ' )) {
58
72
Gate::define ('downloadLogFile ' , fn (mixed $ user , LogFile $ file ) => true );
59
73
}
60
74
61
- if (! Gate::has ('downloadLogFolder ' )) {
75
+ if (!Gate::has ('downloadLogFolder ' )) {
62
76
Gate::define ('downloadLogFolder ' , fn (mixed $ user , LogFolder $ folder ) => true );
63
77
}
64
78
65
- if (! Gate::has ('deleteLogFile ' )) {
79
+ if (!Gate::has ('deleteLogFile ' )) {
66
80
Gate::define ('deleteLogFile ' , fn (mixed $ user , LogFile $ file ) => true );
67
81
}
68
82
69
- if (! Gate::has ('deleteLogFolder ' )) {
83
+ if (!Gate::has ('deleteLogFolder ' )) {
70
84
Gate::define ('deleteLogFolder ' , fn (mixed $ user , LogFolder $ folder ) => true );
71
85
}
72
86
}
0 commit comments