File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed
Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ class TotemServiceProvider extends ServiceProvider
2323 */
2424 public function boot ()
2525 {
26+ try {
27+ if (Totem::baseTableExists ()) {
28+ $ this ->app ->register (ConsoleServiceProvider::class);
29+ }
30+ } catch (\PDOException $ ex ) {
31+ // This will trigger if DB cannot be connected to
32+ Log::error ($ ex ->getMessage ());
33+ }
2634 $ this ->registerResources ();
2735 $ this ->defineAssetPublishing ();
2836
@@ -69,15 +77,6 @@ public function register()
6977 $ this ->app ->register (TotemRouteServiceProvider::class);
7078 $ this ->app ->register (TotemEventServiceProvider::class);
7179 $ this ->app ->register (TotemFormServiceProvider::class);
72-
73- try {
74- if (Totem::baseTableExists ()) {
75- $ this ->app ->register (ConsoleServiceProvider::class);
76- }
77- } catch (\PDOException $ ex ) {
78- // This will trigger if DB cannot be connected to
79- Log::error ($ ex ->getMessage ());
80- }
8180 }
8281
8382 /**
Original file line number Diff line number Diff line change 33namespace Studio \Totem ;
44
55use Closure ;
6+ use Illuminate \Support \Facades \Cache ;
67use Illuminate \Support \Facades \Schema ;
78use Illuminate \Support \Facades \Artisan ;
89use Symfony \Component \Console \Command \Command ;
@@ -87,6 +88,16 @@ public static function getCommands()
8788 */
8889 public static function baseTableExists () : bool
8990 {
90- return Schema::connection (TOTEM_DATABASE_CONNECTION )->hasTable (TOTEM_TABLE_PREFIX .'tasks ' );
91+ if (Cache::get ('totem.table. ' .TOTEM_TABLE_PREFIX .'tasks ' )) {
92+ return true ;
93+ }
94+
95+ if (Schema::hasTable (TOTEM_TABLE_PREFIX .'tasks ' )) {
96+ Cache::forever ('totem.table. ' .TOTEM_TABLE_PREFIX .'tasks ' , true );
97+
98+ return true ;
99+ }
100+
101+ return false ;
91102 }
92103}
You can’t perform that action at this time.
0 commit comments