Skip to content

Commit 61c790d

Browse files
committed
support for two grammar constructor types
1 parent 92c29e8 commit 61c790d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Services/FileMakerConnection.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,20 @@ public function setTimeout($timeout)
874874

875875
protected function getDefaultQueryGrammar()
876876
{
877-
return new FMGrammar;
877+
// check if this is laravel 11 or 12
878+
// Laravel 11 constructs a grammar without any parameters
879+
// Laravel 12 requires a connection as a constructor parameter
880+
$version = app()->version();
881+
// get the major version number
882+
$majorVersion = (int) explode('.', $version)[0];
883+
if ($majorVersion < 12) {
884+
// Laravel 11 and earlier
885+
return new FMGrammar;
886+
}
887+
888+
// Laravel 12
889+
return new FMGrammar($this);
890+
878891
}
879892

880893
// public function getLayoutMetadata($layout = null)

0 commit comments

Comments
 (0)