Skip to content

Commit 6abc508

Browse files
authored
Merge pull request #2 from efureev/laravel-12
Laravel 12
2 parents b6f8cd3 + 0e9b78b commit 6abc508

File tree

9 files changed

+35
-46
lines changed

9 files changed

+35
-46
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
setup: [ 'basic', 'lowest', 'stable' ]
31-
php: [ '8.2' , '8.3' ]
31+
php: [ '8.2', '8.3', '8.4' ]
3232

3333
services:
3434
postgres:
@@ -55,19 +55,6 @@ jobs:
5555
extensions: mbstring
5656
coverage: xdebug
5757

58-
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
59-
id: composer-cache
60-
run: |
61-
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
62-
63-
- name: Cache dependencies
64-
uses: actions/cache@v4
65-
with:
66-
path: ${{ steps.composer-cache.outputs.dir }}
67-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
68-
restore-keys: |
69-
${{ runner.os }}-composer-
70-
7158
- name: Validate composer.json
7259
run: composer validate
7360

@@ -123,19 +110,6 @@ jobs:
123110
extensions: mbstring
124111
coverage: xdebug
125112

126-
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
127-
id: composer-cache
128-
run: |
129-
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
130-
131-
- name: Cache dependencies
132-
uses: actions/cache@v4
133-
with:
134-
path: ${{ steps.composer-cache.outputs.dir }}
135-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
136-
restore-keys: |
137-
${{ runner.os }}-composer-
138-
139113
- name: Install [BASIC] Composer dependencies
140114
run: composer update --prefer-dist --no-interaction --no-suggest
141115

.meta.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ class Blueprint
3737
{
3838
}
3939
}
40-
41-
namespace Illuminate\Database\Query {
42-
43-
/**
44-
* @mixin \Php\Support\Laravel\Database\Query\Builder
45-
*/
46-
class Builder
47-
{
48-
}
49-
}
40+
//
41+
//namespace Illuminate\Database\Query {
42+
//
43+
// /**
44+
// * @mixin \Php\Support\Laravel\Database\Query\Builder
45+
// */
46+
// class Builder
47+
// {
48+
// }
49+
//}
5050

5151
namespace Illuminate\Database\Eloquent {
5252

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ Check MD [online][check-online].
99

1010
## [unreleased]
1111

12+
## [3.0.0] - 2025-02-24
13+
14+
### Added
15+
16+
- Add a support for Laravel 12
17+
1218
## [2.1.0] - 2024-07-22
1319

1420
### Added

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
"require": {
2020
"php": "^8.2",
2121
"ext-pdo": "*",
22-
"illuminate/database": "^11.0 || ^12.0"
22+
"illuminate/database": "^12.0"
2323
},
2424
"require-dev": {
2525
"ergebnis/composer-normalize": "^2.42",
26-
"orchestra/testbench": "^9.0 || ^10.0",
26+
"orchestra/testbench": "^10.0",
2727
"phpstan/phpstan": "^2.0",
2828
"phpunit/phpunit": "^11.5",
2929
"squizlabs/php_codesniffer": "^3.9"

src/Schema/Postgres/Builder.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55
namespace Php\Support\Laravel\Database\Schema\Postgres;
66

77
use Closure;
8+
use Illuminate\Container\Container;
89
use Illuminate\Database\Schema\PostgresBuilder;
910

1011
class Builder extends PostgresBuilder
1112
{
1213
protected function createBlueprint($table, ?Closure $callback = null)
1314
{
14-
return new Blueprint($table, $callback);
15+
$connection = $this->connection;
16+
17+
if (isset($this->resolver)) {
18+
return call_user_func($this->resolver, $connection, $table, $callback);
19+
}
20+
21+
return Container::getInstance()->make(Blueprint::class, compact('connection', 'table', 'callback'));
1522
}
1623

1724
/**

src/Schema/Postgres/Connection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Connection extends BasePostgresConnection
1313
{
1414
protected function getDefaultSchemaGrammar()
1515
{
16-
return $this->withTablePrefix((new Grammar())->addModifier('Compression'));
16+
return (new Grammar($this))->addModifier('Compression');
1717
}
1818

1919

@@ -36,7 +36,7 @@ public function query()
3636

3737
protected function getDefaultQueryGrammar()
3838
{
39-
return new QueryPostgresGrammar();
39+
return new QueryPostgresGrammar($this);
4040
}
4141

4242
public function bindValues($statement, $bindings): void
@@ -47,6 +47,7 @@ public function bindValues($statement, $bindings): void
4747

4848
$dataType = match (true) {
4949
is_bool($value) => PDO::PARAM_BOOL,
50+
is_resource($value) => PDO::PARAM_LOB,
5051
$value === null => PDO::PARAM_NULL,
5152
default => PDO::PARAM_STR,
5253
};

src/Schema/Postgres/Grammar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Grammar extends PostgresGrammar
2020
use CompressionModifier;
2121

2222

23-
public function naming(array $names)
23+
public function naming(array $names): string
2424
{
2525
return implode(', ', array_map([$this, 'wrap'], $names));
2626
}

src/Schema/Postgres/Grammar/CompressionModifier.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
namespace Php\Support\Laravel\Database\Schema\Postgres\Grammar;
66

7-
use Illuminate\Database\Connection;
87
use Illuminate\Database\Schema\Blueprint as BaseBlueprint;
98
use Illuminate\Support\Fluent;
109
use Php\Support\Laravel\Database\Schema\Postgres\Blueprint;
1110

1211
trait CompressionModifier
1312
{
14-
public function compileChange(BaseBlueprint $blueprint, Fluent $command, Connection $connection)
13+
public function compileChange(BaseBlueprint $blueprint, Fluent $command)
1514
{
16-
$queries = (array)parent::compileChange($blueprint, $command, $connection);
15+
$queries = (array)parent::compileChange($blueprint, $command);
1716

1817
foreach ($blueprint->getChangedColumns() as $changedColumn) {
1918
if ($changedColumn->compression !== null) {

src/ServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ protected function registerConnectionServices(): void
2727

2828
$this->app->bind('db.connection', static fn($app) => $app['db']->connection());
2929

30+
$this->app->bind('db.schema', static fn($app) => $app['db']->connection()->getSchemaBuilder());
31+
3032
$this->app->singleton('db.transactions', static fn($app) => new DatabaseTransactionsManager());
3133
}
3234

0 commit comments

Comments
 (0)