Skip to content

Commit 7aad6e4

Browse files
authored
Merge pull request #1070 from bavix/11.x-l13
[11.x] add support laravel 13
2 parents fecc141 + 2b3c329 commit 7aad6e4

14 files changed

+178
-37
lines changed

.github/workflows/phpunits.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,97 @@ jobs:
187187
github-token: ${{ secrets.GITHUB_TOKEN }}
188188
parallel-finished: true
189189
if: ${{ steps.coveralls-check.outputs.execute == 'true' }}
190+
191+
compatibility:
192+
runs-on: ubuntu-latest
193+
194+
strategy:
195+
matrix:
196+
include:
197+
- php-version: 8.3
198+
laravel-version: ^11.0
199+
testbench-version: ^9.0
200+
- php-version: 8.3
201+
laravel-version: ^12.0
202+
testbench-version: ^10.0
203+
- php-version: 8.3
204+
laravel-version: ^13.0
205+
testbench-version: ^11.0
206+
207+
services:
208+
redis:
209+
image: redis:7-alpine
210+
options: >-
211+
--health-cmd "redis-cli ping"
212+
--health-interval 5s
213+
--health-timeout 3s
214+
--health-retries 5
215+
ports:
216+
- 6379:6379
217+
218+
steps:
219+
- name: Checkout
220+
uses: actions/checkout@v6
221+
222+
- name: Setup cache environment
223+
id: extcache-compatibility
224+
uses: shivammathur/cache-extensions@v1
225+
with:
226+
php-version: ${{ matrix.php-version }}
227+
extensions: mbstring, sqlite, redis, bcmath
228+
key: ${{ runner.os }}-compatibility-php-extensions-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
229+
230+
- name: Cache extensions
231+
uses: actions/cache@v4
232+
with:
233+
path: ${{ steps.extcache-compatibility.outputs.dir }}
234+
key: ${{ steps.extcache-compatibility.outputs.key }}
235+
restore-keys: ${{ steps.extcache-compatibility.outputs.key }}
236+
237+
- name: Setup PHP
238+
uses: shivammathur/setup-php@v2
239+
with:
240+
php-version: ${{ matrix.php-version }}
241+
extensions: mbstring, sqlite, redis, bcmath
242+
coverage: pcov
243+
env:
244+
runner: self-hosted
245+
246+
- name: Validate composer.json and composer.lock
247+
run: composer validate --strict
248+
249+
- name: Get Composer cache directory
250+
id: composer-cache-dir-compatibility
251+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
252+
253+
- name: Cache Composer packages
254+
uses: actions/cache@v4
255+
with:
256+
path: vendor
257+
key: ${{ runner.os }}-compatibility-${{ matrix.php-version }}-${{ matrix.laravel-version }}-${{ hashFiles('**/composer.lock') }}
258+
restore-keys: |
259+
${{ runner.os }}-compatibility-${{ matrix.php-version }}-
260+
261+
- name: Cache Composer cache
262+
uses: actions/cache@v4
263+
with:
264+
path: ${{ steps.composer-cache-dir-compatibility.outputs.dir }}
265+
key: ${{ runner.os }}-composer-cache-compatibility-${{ matrix.php-version }}-${{ matrix.laravel-version }}-${{ hashFiles('**/composer.lock') }}
266+
restore-keys: |
267+
${{ runner.os }}-composer-cache-compatibility-${{ matrix.php-version }}-
268+
269+
- name: Install dependencies for compatibility matrix
270+
run: >-
271+
composer update
272+
--prefer-dist
273+
--no-progress
274+
--with "illuminate/contracts:${{ matrix.laravel-version }}"
275+
--with "illuminate/database:${{ matrix.laravel-version }}"
276+
--with "orchestra/testbench:${{ matrix.testbench-version }}"
277+
278+
- name: Run compatibility test suite
279+
run: composer parabench
280+
env:
281+
DB_CONNECTION: testing
282+
WALLET_CACHE_DRIVER: array
283+
WALLET_LOCK_DRIVER: redis

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ laravel-wallet - It's easy to work with a virtual wallet.
2020

2121
| Version | Laravel | PHP | Release date | End of improvements | End of support |
2222
|------------|----------------|-----------------|--------------|---------------------|----------------|
23-
| 11.x [LTS] | ^11.0, ^12.0 | 8.3,8.4,8.5 | Mar 14, 2024 | May 1, 2026 | Sep 6, 2026 |
23+
| 11.x [LTS] | ^11.0, ^12.0, ^13.0 | 8.3,8.4,8.5 | Mar 14, 2024 | May 1, 2026 | Sep 6, 2026 |
2424

2525
### Upgrade Guide
2626

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"driftingly/rector-laravel": "^2.0",
3636
"ergebnis/phpstan-rules": "^2.1",
3737
"infection/infection": "~0.27",
38-
"larastan/larastan": "^3.0|dev-l13",
39-
"laravel/cashier": "^15.0",
38+
"larastan/larastan": "^3.0",
39+
"laravel/cashier": "^15.0|^16.0",
4040
"nunomaduro/collision": "^8.1",
41-
"orchestra/testbench": "^10.0|^11.0",
41+
"orchestra/testbench": "^9.0|^10.0|^11.0",
4242
"phpstan/phpstan": "^2.1",
4343
"phpunit/phpunit": "^11.0|^12.5.12",
4444
"rector/rector": "^2.0",

database/2018_11_06_222923_create_transactions_table.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Bavix\Wallet\Models\Transaction;
65
use Illuminate\Database\Migrations\Migration;
76
use Illuminate\Database\Schema\Blueprint;
87
use Illuminate\Support\Facades\Schema;
@@ -38,6 +37,9 @@ public function down(): void
3837

3938
private function table(): string
4039
{
41-
return (new Transaction())->getTable();
40+
/** @var string $table */
41+
$table = config('wallet.transaction.table', 'transactions');
42+
43+
return $table;
4244
}
4345
};

database/2018_11_07_192923_create_transfers_table.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Bavix\Wallet\Models\Transaction;
6-
use Bavix\Wallet\Models\Transfer;
75
use Illuminate\Database\Migrations\Migration;
86
use Illuminate\Database\Schema\Blueprint;
97
use Illuminate\Support\Facades\Schema;
@@ -56,11 +54,17 @@ public function down(): void
5654

5755
private function table(): string
5856
{
59-
return (new Transfer())->getTable();
57+
/** @var string $table */
58+
$table = config('wallet.transfer.table', 'transfers');
59+
60+
return $table;
6061
}
6162

6263
private function transactionTable(): string
6364
{
64-
return (new Transaction())->getTable();
65+
/** @var string $table */
66+
$table = config('wallet.transaction.table', 'transactions');
67+
68+
return $table;
6569
}
6670
};

database/2018_11_15_124230_create_wallets_table.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Bavix\Wallet\Models\Transaction;
6-
use Bavix\Wallet\Models\Wallet;
75
use Illuminate\Database\Migrations\Migration;
86
use Illuminate\Database\Schema\Blueprint;
97
use Illuminate\Support\Facades\Schema;
@@ -49,11 +47,17 @@ public function down(): void
4947

5048
private function table(): string
5149
{
52-
return (new Wallet())->getTable();
50+
/** @var string $table */
51+
$table = config('wallet.wallet.table', 'wallets');
52+
53+
return $table;
5354
}
5455

5556
private function transactionTable(): string
5657
{
57-
return (new Transaction())->getTable();
58+
/** @var string $table */
59+
$table = config('wallet.transaction.table', 'transactions');
60+
61+
return $table;
5862
}
5963
};

database/2021_11_02_202021_update_wallets_uuid_table.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public function down(): void
5050

5151
private function table(): string
5252
{
53-
return (new Wallet())->getTable();
53+
/** @var string $table */
54+
$table = config('wallet.wallet.table', 'wallets');
55+
56+
return $table;
5457
}
5558
};

database/2023_12_30_113122_extra_columns_removed.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Bavix\Wallet\Models\Transfer;
65
use Illuminate\Database\Migrations\Migration;
76
use Illuminate\Database\Schema\Blueprint;
87
use Illuminate\Support\Facades\Schema;
@@ -34,6 +33,9 @@ public function down(): void
3433

3534
private function table(): string
3635
{
37-
return (new Transfer())->getTable();
36+
/** @var string $table */
37+
$table = config('wallet.transfer.table', 'transfers');
38+
39+
return $table;
3840
}
3941
};

database/2023_12_30_204610_soft_delete.php

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Bavix\Wallet\Models\Transaction;
6-
use Bavix\Wallet\Models\Transfer;
7-
use Bavix\Wallet\Models\Wallet;
85
use Illuminate\Database\Migrations\Migration;
96
use Illuminate\Database\Schema\Blueprint;
107
use Illuminate\Support\Facades\Schema;
@@ -13,27 +10,51 @@
1310
{
1411
public function up(): void
1512
{
16-
Schema::table((new Wallet())->getTable(), static function (Blueprint $table) {
13+
Schema::table($this->walletTable(), static function (Blueprint $table) {
1714
$table->softDeletesTz();
1815
});
19-
Schema::table((new Transfer())->getTable(), static function (Blueprint $table) {
16+
Schema::table($this->transferTable(), static function (Blueprint $table) {
2017
$table->softDeletesTz();
2118
});
22-
Schema::table((new Transaction())->getTable(), static function (Blueprint $table) {
19+
Schema::table($this->transactionTable(), static function (Blueprint $table) {
2320
$table->softDeletesTz();
2421
});
2522
}
2623

2724
public function down(): void
2825
{
29-
Schema::table((new Wallet())->getTable(), static function (Blueprint $table) {
26+
Schema::table($this->walletTable(), static function (Blueprint $table) {
3027
$table->dropSoftDeletes();
3128
});
32-
Schema::table((new Transfer())->getTable(), static function (Blueprint $table) {
29+
Schema::table($this->transferTable(), static function (Blueprint $table) {
3330
$table->dropSoftDeletes();
3431
});
35-
Schema::table((new Transaction())->getTable(), static function (Blueprint $table) {
32+
Schema::table($this->transactionTable(), static function (Blueprint $table) {
3633
$table->dropSoftDeletes();
3734
});
3835
}
36+
37+
private function walletTable(): string
38+
{
39+
/** @var string $table */
40+
$table = config('wallet.wallet.table', 'wallets');
41+
42+
return $table;
43+
}
44+
45+
private function transferTable(): string
46+
{
47+
/** @var string $table */
48+
$table = config('wallet.transfer.table', 'transfers');
49+
50+
return $table;
51+
}
52+
53+
private function transactionTable(): string
54+
{
55+
/** @var string $table */
56+
$table = config('wallet.transaction.table', 'transactions');
57+
58+
return $table;
59+
}
3960
};

database/2024_01_24_185401_add_extra_column_in_transfer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Bavix\Wallet\Models\Transfer;
65
use Illuminate\Database\Migrations\Migration;
76
use Illuminate\Database\Schema\Blueprint;
87
use Illuminate\Support\Facades\Schema;
@@ -25,6 +24,9 @@ public function down(): void
2524

2625
private function table(): string
2726
{
28-
return (new Transfer())->getTable();
27+
/** @var string $table */
28+
$table = config('wallet.transfer.table', 'transfers');
29+
30+
return $table;
2931
}
3032
};

0 commit comments

Comments
 (0)