From 2edb4df669ced0b825b8f72c471e65caaf3fe9cb Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Thu, 19 Jun 2025 17:08:36 +0200 Subject: [PATCH] fix: update migrations to make it compatible with mysql databases --- app/Models/Participation.php | 11 ++++++++--- composer.json | 2 +- .../2023_08_22_091935_create_participations.php | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Models/Participation.php b/app/Models/Participation.php index 0f1ba06..91a5715 100644 --- a/app/Models/Participation.php +++ b/app/Models/Participation.php @@ -45,7 +45,9 @@ class Participation extends Model * @var array */ protected $fillable = [ - 'barcode', 'ticket', 'sticker', + 'barcode', + 'ticket', + 'sticker', ]; /** @@ -179,7 +181,7 @@ class Participation extends Model public function eanCode(): Attribute { return Attribute::make( - get: fn () => optional($this->product)->ean_code, + get: fn() => optional($this->product)->ean_code, ); } @@ -219,7 +221,7 @@ class Participation extends Model public static function customerAlreadyHasAnInstantWin(Customer $customer): bool { return self::query()->whereHas('instantWin') - ->whereHas('customer', fn (Builder $q) => $q->where('id', $customer->id)) + ->whereHas('customer', fn(Builder $q) => $q->where('id', $customer->id)) ->exists(); } @@ -240,5 +242,8 @@ class Participation extends Model if ($model->sticker) { $model->sticker = FileStorageHelper::storeFile($model, $model->sticker, true); } + if (!$model->comment) { + $model->comment = ''; + } } } diff --git a/composer.json b/composer.json index 5a7d6b6..f15b382 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "uwil/gen-game-web", - "version": "2.4.6", + "version": "2.4.7", "type": "project", "description": "Game generator", "support": { diff --git a/database/migrations/2023_08_22_091935_create_participations.php b/database/migrations/2023_08_22_091935_create_participations.php index 2c8b5e0..8cc5a7c 100644 --- a/database/migrations/2023_08_22_091935_create_participations.php +++ b/database/migrations/2023_08_22_091935_create_participations.php @@ -23,7 +23,7 @@ return new class extends Migration $table->string('barcode')->nullable() ->comment('Si gagnant, fichier image du code-barres du produit acheté'); - $table->text('comment')->default('')->comment('Si gagnant, Commentaire des gestionnaires du jeu'); + $table->text('comment')->comment('Si gagnant, Commentaire des gestionnaires du jeu'); $table->boolean('prize_sent')->default(0)->comment('Si gagnant, alors est-ce-que le lot à été envoyé ?'); // * RELATIONSHIPS