File tree Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Expand file tree Collapse file tree 2 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,17 @@ class ConsoleServiceProvider extends ServiceProvider
17
17
*/
18
18
public function boot ()
19
19
{
20
- if (Totem:: baseTableExists () ) {
21
- $ this -> app -> resolving (Schedule::class, function ( $ schedule ) {
20
+ $ this -> app -> resolving (Schedule::class, function ( $ schedule ) {
21
+ if (Totem:: isEnabled () ) {
22
22
$ this ->schedule ($ schedule );
23
- });
24
- }
23
+ }
24
+ });
25
25
}
26
26
27
27
/**
28
28
* Prepare schedule from tasks.
29
29
*
30
- * @param Schedule $schedule
30
+ * @param Schedule $schedule
31
31
*/
32
32
public function schedule (Schedule $ schedule )
33
33
{
Original file line number Diff line number Diff line change 7
7
use Illuminate \Support \Facades \Cache ;
8
8
use Illuminate \Support \Facades \Schema ;
9
9
use Symfony \Component \Console \Command \Command ;
10
+ use Throwable ;
10
11
11
12
class Totem
12
13
{
@@ -20,7 +21,7 @@ class Totem
20
21
/**
21
22
* Determine if the given request can access the Totem dashboard.
22
23
*
23
- * @param \Illuminate\Http\Request $request
24
+ * @param \Illuminate\Http\Request $request
24
25
*
25
26
* @return bool
26
27
*/
@@ -34,7 +35,7 @@ public static function check($request)
34
35
/**
35
36
* Set the callback that should be used to authenticate Totem users.
36
37
*
37
- * @param \Closure $callback
38
+ * @param \Closure $callback
38
39
*
39
40
* @return static
40
41
*/
@@ -91,16 +92,20 @@ public static function getCommands()
91
92
/**
92
93
* @return bool
93
94
*/
94
- public static function baseTableExists (): bool
95
+ public static function isEnabled (): bool
95
96
{
96
- if (Cache::get ('totem.table. ' .TOTEM_TABLE_PREFIX .'tasks ' )) {
97
- return true ;
98
- }
97
+ try {
98
+ if (Cache::get ('totem.table. ' .TOTEM_TABLE_PREFIX .'tasks ' )) {
99
+ return true ;
100
+ }
99
101
100
- if (Schema::hasTable (TOTEM_TABLE_PREFIX .'tasks ' )) {
101
- Cache::forever ('totem.table. ' .TOTEM_TABLE_PREFIX .'tasks ' , true );
102
+ if (Schema::hasTable (TOTEM_TABLE_PREFIX .'tasks ' )) {
103
+ Cache::forever ('totem.table. ' .TOTEM_TABLE_PREFIX .'tasks ' , true );
102
104
103
- return true ;
105
+ return true ;
106
+ }
107
+ } catch (Throwable $ e ) {
108
+ return false ;
104
109
}
105
110
106
111
return false ;
You can’t perform that action at this time.
0 commit comments