Skip to content

Commit f265b78

Browse files
Feat: Add Support for Laravel 12 (#205)
* Laravel 12 * update tests for BC compatibility with L12 * style updates --------- Co-authored-by: Eric Tucker <[email protected]>
1 parent 38c1dee commit f265b78

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
],
1919
"require": {
2020
"php": ">=7.2",
21-
"illuminate/console": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
22-
"illuminate/filesystem": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
23-
"illuminate/database": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
24-
"illuminate/support": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
25-
"illuminate/config": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
26-
"illuminate/pagination": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0"
21+
"illuminate/console": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0|~12.0",
22+
"illuminate/filesystem": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0|~12.0",
23+
"illuminate/database": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0|~12.0",
24+
"illuminate/support": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0|~12.0",
25+
"illuminate/config": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0|~12.0",
26+
"illuminate/pagination": "~6.0|~7.0|~8.0|~9.0|~10.0|~11.0|~12.0"
2727
},
2828
"require-dev": {
2929
"phpunit/phpunit": "^8",

tests/ModelFilterChildTest.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ public function testPaginationWorksOnBelongsToMany()
8989
// Paginating relations will work before L5.4 but won't contain the pivot attribute
9090
$this->markTestSkipped(
9191
'Pagination is overwritten with a Relation macro to append the pivot to pivotable relations.'
92-
.' This was introduced in Laravel 5.4 when Relations implemented the Macroable trait.'
93-
.' https://github.com/illuminate/database/commit/4d13b0f80439bd17befb0fd646a117b818efdb14'
92+
.' This was introduced in Laravel 5.4 when Relations implemented the Macroable trait.'
93+
.' https://github.com/illuminate/database/commit/4d13b0f80439bd17befb0fd646a117b818efdb14'
9494
);
9595
}
9696
}
@@ -114,8 +114,13 @@ protected function dbSetup()
114114
$this->db = new DatabaseManager($container, new ConnectionFactory($container));
115115
Model::setConnectionResolver($this->db);
116116
$connection = $this->db->connection('sqlite');
117-
$connection->setSchemaGrammar(new \Illuminate\Database\Schema\Grammars\SQLiteGrammar);
118-
$connection->setQueryGrammar(new \Illuminate\Database\Query\Grammars\SQLiteGrammar);
117+
$installedVersion = (int) \Composer\InstalledVersions::getVersion('illuminate/database');
118+
$connection->setSchemaGrammar(
119+
$installedVersion >= 12 ? new \Illuminate\Database\Schema\Grammars\SQLiteGrammar($connection) : new \Illuminate\Database\Schema\Grammars\SQLiteGrammar
120+
);
121+
$connection->setQueryGrammar(
122+
$installedVersion >= 12 ? new \Illuminate\Database\Query\Grammars\SQLiteGrammar($connection) : new \Illuminate\Database\Query\Grammars\SQLiteGrammar
123+
);
119124
$this->schema = new SchemaBuilder($connection);
120125
$this->schema->create('users', function (\Illuminate\Database\Schema\Blueprint $table) {
121126
$table->increments('id');

0 commit comments

Comments
 (0)