Skip to content

Commit db62dfd

Browse files
committed
Upgrade to Laravel 11
1 parent 0f2164c commit db62dfd

File tree

9 files changed

+27
-12
lines changed

9 files changed

+27
-12
lines changed

app/Http/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Kernel extends HttpKernel
5353
*
5454
* @var array
5555
*/
56-
protected $routeMiddleware = [
56+
protected $middlewareAliases = [
5757
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
5858
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
5959
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,

app/Models/CardImage.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
*/
2828
class CardImage extends Model
2929
{
30-
protected $casts = ['last_uploaded' => 'datetime'];
31-
3230
public function getMd5(): string
3331
{
3432
return $this->getAttribute('md5');
@@ -38,4 +36,8 @@ public function getLastUploaded(): ?\DateTimeInterface
3836
{
3937
return $this->getAttribute('last_uploaded');
4038
}
39+
protected function casts(): array
40+
{
41+
return ['last_uploaded' => 'datetime'];
42+
}
4143
}

app/Models/Set.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ public function getFullName(string $locale): string
3838
return sprintf('%s %s', $name, $this->version);
3939
}
4040

41-
public function getBrandAttribute()
41+
protected function brand(): \Illuminate\Database\Eloquent\Casts\Attribute
4242
{
43-
return BrandMapper::getBrand($this->name_ja);
43+
return \Illuminate\Database\Eloquent\Casts\Attribute::make(get: function () {
44+
return BrandMapper::getBrand($this->name_ja);
45+
});
4446
}
4547
}

database/factories/CardFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
use amcsi\LyceeOverture\Card\Type;
88
use Illuminate\Database\Eloquent\Factories\Factory;
99

10+
/**
11+
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\amcsi\LyceeOverture\Models\Card>
12+
*/
1013
class CardFactory extends Factory
1114
{
1215
private static $increment = 1;

database/factories/CardTranslationFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use amcsi\LyceeOverture\I18n\Locale;
1010
use Illuminate\Database\Eloquent\Factories\Factory;
1111

12+
/**
13+
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\amcsi\LyceeOverture\Models\CardTranslation>
14+
*/
1215
class CardTranslationFactory extends Factory
1316
{
1417
protected $model = CardTranslation::class;

database/factories/SuggestionFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use amcsi\LyceeOverture\Models\User;
1010
use Illuminate\Database\Eloquent\Factories\Factory;
1111

12+
/**
13+
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\amcsi\LyceeOverture\Models\Suggestion>
14+
*/
1215
class SuggestionFactory extends Factory
1316
{
1417
protected $model = Suggestion::class;

database/factories/UserFactory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
use Illuminate\Database\Eloquent\Factories\Factory;
88
use Illuminate\Support\Str;
99

10+
/**
11+
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\amcsi\LyceeOverture\Models\User>
12+
*/
1013
class UserFactory extends Factory
1114
{
1215
/**
@@ -24,8 +27,8 @@ class UserFactory extends Factory
2427
public function definition()
2528
{
2629
return [
27-
'name' => $this->faker->name,
28-
'email' => $this->faker->unique()->safeEmail,
30+
'name' => fake()->name,
31+
'email' => fake()->unique()->safeEmail,
2932
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
3033
'remember_token' => Str::random(10),
3134
'can_approve_locale' => '',

database/migrations/2018_07_14_133856_create_card_sets.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function (Blueprint $table) {
2020
$table->increments('id');
2121
$table->string('name_jp');
2222
$table->string('name_en')->default('');
23-
$table->string('cards')->string();
23+
$table->string('cards');
2424
$table->boolean('deck');
2525
$table->timestamps();
2626
}

database/migrations/2024_02_15_152246_add_comments_field_text.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
use Illuminate\Database\Migrations\Migration;
44
use Illuminate\Database\Schema\Blueprint;
55

6-
return new class extends Migration
7-
{
6+
return new class extends Migration {
87
public function up(): void
98
{
109
\Schema::table('card_translations', function (Blueprint $table) {
11-
$table->text('comments')->default('')->change();
10+
$table->string('comments', 2000)->default('')->change();
1211
});
1312
\Schema::table('suggestions', function (Blueprint $table) {
14-
$table->text('comments')->default('')->change();
13+
$table->string('comments', 2000)->default('')->change();
1514
});
1615
}
1716

0 commit comments

Comments
 (0)