Skip to content

Commit 24f133e

Browse files
[5.x] Adds L11 support (#1410)
* Adds L11 support * Adjust test suite * Keeps working on adding L11 support * wip * Fixes fortify redirect route * Removes unused replace * Comments * Removes usage of RouteServiceProvider * Installs API earlier * Fixes migrations * Adds missing password_reset_tokens * Ensures middleware folders exists * Removes non-used imports * Removes non-used import * Uses `addProviderToBootstrapFile` * Uses `publishesMigrations` and points fortify to develop * Uses stable version of Jetstream * Uses stable version of Inertia and Sanctum * Uses PHPUnit 10.4 * Updates user migrations * Avoids creation of session table if already exists * Does not installs again Sanctum migrations * Fixes tests on L11 * Don't uses `AUTH_GUARD=sanctum` * Updates user model * Apply fixes from StyleCI * Uses `casts` method for `Team` model * Uses `casts` on UserWithTeams * Updates UserFactory --------- Co-authored-by: StyleCI Bot <[email protected]>
1 parent 1a8325f commit 24f133e

17 files changed

+157
-159
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
strategy:
1717
fail-fast: true
1818
matrix:
19-
php: [8.1, 8.2, 8.3]
20-
laravel: [10]
19+
php: [8.2, 8.3]
20+
laravel: [11]
2121

2222
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
2323

@@ -49,7 +49,7 @@ jobs:
4949
fail-fast: true
5050
matrix:
5151
stack: [inertia, livewire]
52-
laravel: [10]
52+
laravel: [11]
5353

5454
name: Test Stubs - Laravel ${{ matrix.laravel }} - ${{ matrix.stack }}
5555

@@ -64,11 +64,19 @@ jobs:
6464
coverage: none
6565

6666
- name: Setup Laravel
67+
if: matrix.laravel != 11
6768
run: |
6869
composer create-project laravel/laravel:^${{ matrix.laravel }} .
6970
composer require laravel/jetstream:@dev --no-interaction --no-update
7071
composer config repositories.jetstream '{"type": "path", "url": "jetstream"}' --file composer.json
7172
73+
- name: Setup Laravel
74+
if: matrix.laravel == 11
75+
run: |
76+
composer create-project laravel/laravel:dev-master .
77+
composer require laravel/jetstream:@dev --no-interaction --no-update
78+
composer config repositories.jetstream '{"type": "path", "url": "jetstream"}' --file composer.json
79+
7280
- name: Checkout code
7381
uses: actions/checkout@v3
7482
with:

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^8.1.0",
17+
"php": "^8.2.0",
1818
"ext-json": "*",
19-
"illuminate/console": "^10.17",
20-
"illuminate/support": "^10.17",
21-
"laravel/fortify": "^1.19",
19+
"illuminate/console": "^11.0",
20+
"illuminate/support": "^11.0",
21+
"laravel/fortify": "dev-develop",
2222
"mobiledetect/mobiledetectlib": "^4.8"
2323
},
2424
"require-dev": {
25-
"inertiajs/inertia-laravel": "^0.6.5",
26-
"laravel/sanctum": "^3.0",
27-
"livewire/livewire": "^3.0",
25+
"inertiajs/inertia-laravel": "^1.0",
26+
"laravel/sanctum": "^4.0",
27+
"livewire/livewire": "dev-feat/l11",
2828
"mockery/mockery": "^1.0",
29-
"orchestra/testbench": "^8.11",
29+
"orchestra/testbench": "^9.0",
3030
"phpstan/phpstan": "^1.10",
31-
"phpunit/phpunit": "^10.1"
31+
"phpunit/phpunit": "^10.4"
3232
},
3333
"autoload": {
3434
"psr-4": {

database/factories/TeamFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Database\Factories;
44

5-
use App\Models\Team;
65
use App\Models\User;
76
use Illuminate\Database\Eloquent\Factories\Factory;
87

database/factories/UserFactory.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Models\Team;
66
use App\Models\User;
77
use Illuminate\Database\Eloquent\Factories\Factory;
8+
use Illuminate\Support\Facades\Hash;
89
use Illuminate\Support\Str;
910
use Laravel\Jetstream\Features;
1011

@@ -13,6 +14,11 @@
1314
*/
1415
class UserFactory extends Factory
1516
{
17+
/**
18+
* The current password being used by the factory.
19+
*/
20+
protected static ?string $password;
21+
1622
/**
1723
* Define the model's default state.
1824
*
@@ -21,10 +27,10 @@ class UserFactory extends Factory
2127
public function definition(): array
2228
{
2329
return [
24-
'name' => $this->faker->name(),
25-
'email' => $this->faker->unique()->safeEmail(),
30+
'name' => fake()->name(),
31+
'email' => fake()->unique()->safeEmail(),
2632
'email_verified_at' => now(),
27-
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
33+
'password' => static::$password ??= Hash::make('password'),
2834
'two_factor_secret' => null,
2935
'two_factor_recovery_codes' => null,
3036
'remember_token' => Str::random(10),
@@ -38,11 +44,9 @@ public function definition(): array
3844
*/
3945
public function unverified(): static
4046
{
41-
return $this->state(function (array $attributes) {
42-
return [
43-
'email_verified_at' => null,
44-
];
45-
});
47+
return $this->state(fn (array $attributes) => [
48+
'email_verified_at' => null,
49+
]);
4650
}
4751

4852
/**

database/migrations/2014_10_12_000000_create_users_table.php renamed to database/migrations/0001_01_01_000000_create_users_table.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ public function up(): void
2222
$table->string('profile_photo_path', 2048)->nullable();
2323
$table->timestamps();
2424
});
25+
26+
Schema::create('password_reset_tokens', function (Blueprint $table) {
27+
$table->string('email')->primary();
28+
$table->string('token');
29+
$table->timestamp('created_at')->nullable();
30+
});
31+
32+
Schema::create('sessions', function (Blueprint $table) {
33+
$table->string('id')->primary();
34+
$table->foreignId('user_id')->nullable()->index();
35+
$table->string('ip_address', 45)->nullable();
36+
$table->text('user_agent')->nullable();
37+
$table->longText('payload');
38+
$table->integer('last_activity')->index();
39+
});
2540
}
2641

2742
/**
@@ -30,5 +45,7 @@ public function up(): void
3045
public function down(): void
3146
{
3247
Schema::dropIfExists('users');
48+
Schema::dropIfExists('password_reset_tokens');
49+
Schema::dropIfExists('sessions');
3350
}
3451
};

0 commit comments

Comments
 (0)