Skip to content

Commit 4bad003

Browse files
authored
Merge pull request #2 from lucacri/copilot/fix-2913531-754326037-98a4cf5b-52c8-4759-85cc-fe16b804de7b
Fix Laravel 12 compatibility: update Grammar initialization pattern
2 parents a5a7e0a + 60d89b7 commit 4bad003

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/CockroachDbConnection.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CockroachDbConnection extends PostgresConnection implements ConnectionInte
2222
*/
2323
protected function getDefaultQueryGrammar(): BaseGrammar
2424
{
25-
return $this->withTablePrefix($this->setConnection(new QueryGrammar($this)));
25+
return new QueryGrammar($this);
2626
}
2727

2828
/**
@@ -46,7 +46,7 @@ public function getSchemaBuilder(): DbBuilder
4646
*/
4747
protected function getDefaultSchemaGrammar(): BaseGrammar
4848
{
49-
return $this->withTablePrefix($this->setConnection(new SchemaGrammar($this)));
49+
return new SchemaGrammar($this);
5050
}
5151

5252
/**
@@ -81,15 +81,4 @@ protected function getDoctrineDriver()
8181
return new PostgresDriver();
8282
}
8383

84-
/**
85-
* Required to set the connection. This isn't compatible with older Laravel versions
86-
*/
87-
protected function setConnection(BaseGrammar $grammar): BaseGrammar
88-
{
89-
if (method_exists($grammar, 'setConnection')) {
90-
return $grammar->setConnection($this);
91-
}
92-
93-
return $grammar;
94-
}
9584
}

0 commit comments

Comments
 (0)