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
1717 */
1818 public function boot ()
1919 {
20- if (Totem:: baseTableExists () ) {
21- $ this -> app -> resolving (Schedule::class, function ( $ schedule ) {
20+ $ this -> app -> resolving (Schedule::class, function ( $ schedule ) {
21+ if (Totem:: isEnabled () ) {
2222 $ this ->schedule ($ schedule );
23- });
24- }
23+ }
24+ });
2525 }
2626
2727 /**
2828 * Prepare schedule from tasks.
2929 *
30- * @param Schedule $schedule
30+ * @param Schedule $schedule
3131 */
3232 public function schedule (Schedule $ schedule )
3333 {
Original file line number Diff line number Diff line change 77use Illuminate \Support \Facades \Cache ;
88use Illuminate \Support \Facades \Schema ;
99use Symfony \Component \Console \Command \Command ;
10+ use Throwable ;
1011
1112class Totem
1213{
@@ -20,7 +21,7 @@ class Totem
2021 /**
2122 * Determine if the given request can access the Totem dashboard.
2223 *
23- * @param \Illuminate\Http\Request $request
24+ * @param \Illuminate\Http\Request $request
2425 *
2526 * @return bool
2627 */
@@ -34,7 +35,7 @@ public static function check($request)
3435 /**
3536 * Set the callback that should be used to authenticate Totem users.
3637 *
37- * @param \Closure $callback
38+ * @param \Closure $callback
3839 *
3940 * @return static
4041 */
@@ -91,16 +92,20 @@ public static function getCommands()
9192 /**
9293 * @return bool
9394 */
94- public static function baseTableExists (): bool
95+ public static function isEnabled (): bool
9596 {
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+ }
99101
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 );
102104
103- return true ;
105+ return true ;
106+ }
107+ } catch (Throwable $ e ) {
108+ return false ;
104109 }
105110
106111 return false ;
You can’t perform that action at this time.
0 commit comments