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
23
23
*/
24
24
public function boot ()
25
25
{
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
+ }
26
34
$ this ->registerResources ();
27
35
$ this ->defineAssetPublishing ();
28
36
@@ -69,15 +77,6 @@ public function register()
69
77
$ this ->app ->register (TotemRouteServiceProvider::class);
70
78
$ this ->app ->register (TotemEventServiceProvider::class);
71
79
$ 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
- }
81
80
}
82
81
83
82
/**
Original file line number Diff line number Diff line change 3
3
namespace Studio \Totem ;
4
4
5
5
use Closure ;
6
+ use Illuminate \Support \Facades \Cache ;
6
7
use Illuminate \Support \Facades \Schema ;
7
8
use Illuminate \Support \Facades \Artisan ;
8
9
use Symfony \Component \Console \Command \Command ;
@@ -87,6 +88,16 @@ public static function getCommands()
87
88
*/
88
89
public static function baseTableExists () : bool
89
90
{
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 ;
91
102
}
92
103
}
You can’t perform that action at this time.
0 commit comments