diff --git a/app/Models/Brand.php b/app/Models/Brand.php index 64267f7..8418543 100644 --- a/app/Models/Brand.php +++ b/app/Models/Brand.php @@ -10,14 +10,15 @@ use Illuminate\Support\Facades\Cache; use Uwil\LaravelCommon\Helpers\FileHelper; /** - * @property integer $id Brand id. - * @property string $name Brand name. - * @property string $logo Brand logo. - * @property string $url Brand url link. - * @property string $url_claim Brand associative url claim. - * @property string $domain Brand domain. - * @property-read \Illuminate\Support\Carbon $created_at Brand created date. - * @property-read \Illuminate\Support\Carbon $updated_at Brand updated date. + * @property integer $id Brand id. + * @property string $name Brand name. + * @property string $logo Brand logo. + * @property string $url Brand url link. + * @property string $url_claim Brand associative url claim. + * @property string $domain Brand domain. + * @property string $newsletter_email Brand associative newsletter email. + * @property-read \Illuminate\Support\Carbon $created_at Brand created date. + * @property-read \Illuminate\Support\Carbon $updated_at Brand updated date. * * @property-read \Illuminate\Database\Eloquent\Collection * $services Service HasMany relation. @@ -46,6 +47,7 @@ class Brand extends Model 'url', 'url_claim', 'domain', + 'newsletter_email', ]; /** diff --git a/database/factories/BrandFactory.php b/database/factories/BrandFactory.php index f77185b..7193aaf 100644 --- a/database/factories/BrandFactory.php +++ b/database/factories/BrandFactory.php @@ -22,10 +22,11 @@ class BrandFactory extends Factory public function definition(): array { return [ - 'name' => $this->faker->unique()->company, - 'url' => $this->faker->url, - 'url_claim' => $this->faker->url, - 'domain' => $this->faker->unique()->domainName, + 'name' => $this->faker->unique()->company, + 'url' => $this->faker->url, + 'url_claim' => $this->faker->url, + 'domain' => $this->faker->unique()->domainName, + 'newsletter_email' => $this->faker->email ]; } } diff --git a/database/migrations/2026_04_03_152802_alter_brands_table.php b/database/migrations/2026_04_03_152802_alter_brands_table.php new file mode 100644 index 0000000..1a7ef69 --- /dev/null +++ b/database/migrations/2026_04_03_152802_alter_brands_table.php @@ -0,0 +1,28 @@ +string('newsletter_email')->nullable()->comment('Brand associative newsletter email.')->after('domain'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('brands', function (Blueprint $table) { + $table->dropColumn('newsletter_email'); + }); + } +}; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 60a633d..6c12f64 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -222,20 +222,21 @@ return [ 'year' => 'year', ], 'custom' => [ - 'event' => 'event', - 'model' => 'target element', - 'order' => 'order', - 'publication' => 'publication', - 'activated' => 'activated', - 'target' => 'target', - 'response_type' => 'response type', - 'reference' => 'reference', - 'type' => 'type', - 'status' => 'status', - 'label' => 'label', - 'domain' => 'domain', - 'logo' => 'logo', - 'url' => 'url', - 'url_claim' => 'claim url', + 'event' => 'event', + 'model' => 'target element', + 'order' => 'order', + 'publication' => 'publication', + 'activated' => 'activated', + 'target' => 'target', + 'response_type' => 'response type', + 'reference' => 'reference', + 'type' => 'type', + 'status' => 'status', + 'label' => 'label', + 'domain' => 'domain', + 'logo' => 'logo', + 'url' => 'url', + 'url_claim' => 'claim url', + 'newsletter_email' => 'email address for the newsletter', ], ]; diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index de1e26f..640ea35 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -222,20 +222,21 @@ return [ 'year' => 'année', ], 'custom' => [ - 'event' => 'évènement', - 'model' => 'élément ciblé', - 'order' => 'order', - 'publication' => 'publication', - 'activated' => 'activé', - 'target' => 'cible', - 'response_type' => 'type de réponse', - 'reference' => 'référence', - 'type' => 'type', - 'status' => 'status', - 'label' => 'libellé', - 'domain' => 'domaine', - 'logo' => 'logo', - 'url' => 'lien', - 'url_claim' => 'lien réclamation', + 'event' => 'évènement', + 'model' => 'élément ciblé', + 'order' => 'order', + 'publication' => 'publication', + 'activated' => 'activé', + 'target' => 'cible', + 'response_type' => 'type de réponse', + 'reference' => 'référence', + 'type' => 'type', + 'status' => 'status', + 'label' => 'libellé', + 'domain' => 'domaine', + 'logo' => 'logo', + 'url' => 'lien', + 'url_claim' => 'lien réclamation', + 'newsletter_email' => 'adresse email pour la newsletter', ], ]; diff --git a/resources/views/bo/pages/brands/form.blade.php b/resources/views/bo/pages/brands/form.blade.php index 0b1b073..11c4e80 100644 --- a/resources/views/bo/pages/brands/form.blade.php +++ b/resources/views/bo/pages/brands/form.blade.php @@ -89,8 +89,31 @@ + {{-- NEWSLETTER_EMAIL --}} +
+
+ {{ str(__('validation.custom.newsletter_email'))->ucfirst() }} +
+
+ @include('bo.partials.inputs.varchar', [ + 'id' => 'brandNewsletterEmail', + 'label' => __(':field de la :model', [ + 'field' => str(__('validation.custom.newsletter_email'))->ucfirst(), + 'model' => str(__('models.classes.brands'))->singular(), + ]), + 'hasWordCounter' => true, + 'name' => 'newsletter_email', + 'required' => false, + 'model' => $brandModel ?? null, + 'placeholder' => 'no-reply@example.com', + 'helper' => __('Adresse email utilisée pour l\'envoi de la newsletter.'), + ]) +
+
+
+
{{-- IMAGE --}} -
+
{{ str(__('validation.attributes.image'))->ucfirst() }}