From 839335ed3f972462e81e6761bf940f3d357da3b7 Mon Sep 17 00:00:00 2001 From: Konstantinos Arvanitakis Date: Mon, 28 Sep 2026 17:36:37 +0300 Subject: [PATCH] Feat: Adding Contact options to Store Details --- ...nd_legal_fields_to_store_details_table.php | 57 +++++++++++++++++++ .../Filament/Pages/ManageStoreDetails.php | 9 +++ src/Store/Models/StoreDetails.php | 1 + src/Store/Services/StoreDetailsService.php | 1 + 4 files changed, 68 insertions(+) create mode 100644 database/migrations/2026_09_28_000003_add_contact_and_legal_fields_to_store_details_table.php diff --git a/database/migrations/2026_09_28_000003_add_contact_and_legal_fields_to_store_details_table.php b/database/migrations/2026_09_28_000003_add_contact_and_legal_fields_to_store_details_table.php new file mode 100644 index 0000000..17b6f36 --- /dev/null +++ b/database/migrations/2026_09_28_000003_add_contact_and_legal_fields_to_store_details_table.php @@ -0,0 +1,57 @@ +string('contact_email')->nullable()->after('phone'); + $table->string('mail_from_name')->nullable()->after('contact_email'); + $table->json('legal_name')->nullable()->after('registration_number'); + }); + + $emptyPerLocale = json_encode( + Language::query()->pluck('code')->mapWithKeys(fn (string $code) => [$code => ''])->all() + ); + + foreach (['name', 'address', 'bank_transfer_instructions', 'legal_name'] as $column) { + DB::table('store_details')->whereNull($column)->update([$column => $emptyPerLocale]); + } + } + + public function down(): void + { + Schema::table('store_details', function (Blueprint $table) { + $table->dropColumn(['contact_email', 'mail_from_name', 'legal_name']); + }); + } +}; diff --git a/src/Store/Filament/Pages/ManageStoreDetails.php b/src/Store/Filament/Pages/ManageStoreDetails.php index 6bb94be..59e70d0 100644 --- a/src/Store/Filament/Pages/ManageStoreDetails.php +++ b/src/Store/Filament/Pages/ManageStoreDetails.php @@ -80,10 +80,19 @@ class ManageStoreDetails extends Page implements HasForms TextInput::make('phone') ->label('Phone') ->tel(), + TextInput::make('contact_email') + ->label('Contact email') + ->email() + ->helperText('Receives the contact form, and is shown to customers as the store\'s contact email.'), + TextInput::make('mail_from_name') + ->label('Mail from name') + ->helperText('The sender name on outgoing emails (MAIL_FROM_NAME).'), ]), Section::make('Legal') ->description('Shown on invoices and terms pages.') ->schema([ + TranslatedText::make('legal_name') + ->label('Legal name'), TextInput::make('tax_identifier') ->label('Tax ID (ΑΦΜ)'), TextInput::make('registration_number') diff --git a/src/Store/Models/StoreDetails.php b/src/Store/Models/StoreDetails.php index 121454a..d085f9e 100644 --- a/src/Store/Models/StoreDetails.php +++ b/src/Store/Models/StoreDetails.php @@ -21,5 +21,6 @@ class StoreDetails extends Model 'name' => 'array', 'address' => 'array', 'bank_transfer_instructions' => 'array', + 'legal_name' => 'array', ]; } diff --git a/src/Store/Services/StoreDetailsService.php b/src/Store/Services/StoreDetailsService.php index c5d9452..8ff2e11 100644 --- a/src/Store/Services/StoreDetailsService.php +++ b/src/Store/Services/StoreDetailsService.php @@ -67,6 +67,7 @@ class StoreDetailsService 'name' => $this->emptyPerLocale(), 'address' => $this->emptyPerLocale(), 'bank_transfer_instructions' => $this->emptyPerLocale(), + 'legal_name' => $this->emptyPerLocale(), ]); }