feat: Update EAN Code type

This commit is contained in:
Vincent BRIDIER 2025-08-07 14:45:16 +02:00
parent 3ee3b5c69a
commit 48260952a4
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
6 changed files with 6 additions and 11 deletions

View file

@ -43,7 +43,6 @@ class StoreProductRequest extends FormRequest
'name' => 'required|string|min:3|max:255',
'ean_code' => [
'required',
'numeric',
'unique:products,ean_code',
'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/',
],

View file

@ -29,7 +29,6 @@ class UpdateProductRequest extends StoreProductRequest
return array_merge(parent::rules(), [
'ean_code' => [
'required',
'numeric',
Rule::unique('products', 'ean_code')->ignore($productModel->id),
'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/',
],

View file

@ -17,7 +17,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @property string $picture Path of the picture
* @property string $picture_alt Alt text for the picture
* @property string $picture_title Title text for the picture
* @property integer $ean_code Ean code
* @property string $ean_code Ean code
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
*

View file

@ -1,10 +1,10 @@
{
"name": "uwil/gen-game-web",
"version": "2.4.10",
"version": "2.5.10",
"type": "project",
"description": "Game generator",
"support": {
"email": "equipe.web@ldc.fr"
"email": "digital@ldc.fr"
},
"keywords": [
"game",

View file

@ -20,7 +20,7 @@ return new class extends Migration
$table->string('picture_alt')->nullable()->comment('Attribut alt de l\'image du produit');
$table->string('picture_title')->nullable()->comment('Attribut title de l\'image du produit');
$table->unsignedBigInteger('ean_code')->comment('Code EAN du produit pour la participation au jeu');
$table->string('ean_code')->comment('Code EAN du produit pour la participation au jeu');
$table->foreignId('range_id')->before('created_at')->references('id')
->on('ranges')->onDelete('cascade');

View file

@ -110,7 +110,7 @@
<legend>{{ Str::ucfirst(__('validation.custom.ean_code')) }}</legend>
<div class="row">
<div class="col-12">
@include('back::partials.inputs.int-number', [
@include('back::partials.inputs.varchar', [
'id' => 'productEANCode',
'label' => __(':field', [
'field' => Str::ucfirst(__('validation.custom.ean_code')),
@ -122,10 +122,7 @@
'attribute' => __(':field', [
'field' => Str::ucfirst(__('validation.custom.ean_code')),
]),
]),
// Unsigned between 7 and 13 digits
'min' => 1000000,
'max' => 9999999999999,
])
])
</div>
</div>