File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class CockroachDbConnection extends PostgresConnection implements ConnectionInte
22
22
*/
23
23
protected function getDefaultQueryGrammar (): BaseGrammar
24
24
{
25
- return $ this ->withTablePrefix ((new QueryGrammar ())-> setConnection ( $ this ));
25
+ return $ this ->withTablePrefix ($ this -> setConnection (new QueryGrammar ()));
26
26
}
27
27
28
28
/**
@@ -46,7 +46,7 @@ public function getSchemaBuilder(): DbBuilder
46
46
*/
47
47
protected function getDefaultSchemaGrammar (): BaseGrammar
48
48
{
49
- return $ this ->withTablePrefix ((new SchemaGrammar ())-> setConnection ( $ this ));
49
+ return $ this ->withTablePrefix ($ this -> setConnection (new SchemaGrammar ()));
50
50
}
51
51
52
52
/**
@@ -77,4 +77,16 @@ protected function getDoctrineDriver()
77
77
{
78
78
return new PostgresDriver ();
79
79
}
80
+
81
+ /**
82
+ * Required to set the connection. This isn't compatible with older Laravel versions
83
+ */
84
+ protected function setConnection (BaseGrammar $ grammar ): BaseGrammar
85
+ {
86
+ if (method_exists ($ grammar , 'setConnection ' )) {
87
+ return $ grammar ->setConnection ($ this );
88
+ }
89
+
90
+ return $ grammar ;
91
+ }
80
92
}
You can’t perform that action at this time.
0 commit comments