From 5233890030ab6d8d0e696480824b5e339e43f0ba Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Fri, 12 Jun 2026 13:24:53 +0700 Subject: [PATCH] Update SystemRequest, SystemService, and SystemSettings to require address, email, phone, and about_app fields. Modify database migration to set default values for new fields. Enhance SystemSection component to include address input and update TypeScript definitions accordingly. --- .../Requests/Admin/System/Setting/SystemRequest.php | 11 ++++++----- app/Services/System/Setting/SystemService.php | 2 ++ app/Settings/SystemSettings.php | 8 +++++--- .../2026_06_11_085959_create_app_settings.php | 11 ++++++----- .../js/components/admin/setting/SystemSection.vue | 10 ++++++++++ resources/js/types/setting.ts | 11 ++++++----- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/app/Http/Requests/Admin/System/Setting/SystemRequest.php b/app/Http/Requests/Admin/System/Setting/SystemRequest.php index 49b2169..23dc6be 100644 --- a/app/Http/Requests/Admin/System/Setting/SystemRequest.php +++ b/app/Http/Requests/Admin/System/Setting/SystemRequest.php @@ -16,11 +16,12 @@ public function rules(): array { return [ 'app_name' => ['required', 'string', 'max:100'], - 'about_app' => ['nullable', 'string'], - 'email' => ['nullable', 'email', 'max:100'], - 'phone' => ['nullable', 'string', 'max:20'], - 'logo' => ['nullable', 'image', 'max:2048'], - 'login_cover' => ['nullable', 'image', 'max:5120'], + 'about_app' => ['required', 'string'], + 'email' => ['required', 'email', 'max:100'], + 'phone' => ['required', 'string', 'max:20'], + 'address' => ['required', 'string'], + 'logo' => ['required', 'image', 'max:2048'], + 'login_cover' => ['required', 'image', 'max:5120'], ]; } } diff --git a/app/Services/System/Setting/SystemService.php b/app/Services/System/Setting/SystemService.php index 6eceb4d..6c1588e 100644 --- a/app/Services/System/Setting/SystemService.php +++ b/app/Services/System/Setting/SystemService.php @@ -29,6 +29,7 @@ public function systemData(): array 'about_app' => $settings->about_app, 'email' => $settings->email, 'phone' => $settings->phone, + 'address' => $settings->address, 'logo_url' => $logo['url'] ?? null, 'login_cover_url' => $loginCover['url'] ?? null, ]; @@ -43,6 +44,7 @@ public function updateSystem(array $validated): void $settings->about_app = $validated['about_app'] ?? null; $settings->email = $validated['email'] ?? null; $settings->phone = $validated['phone'] ?? null; + $settings->address = $validated['address'] ?? null; $settings->save(); if (isset($validated['logo']) && $validated['logo'] instanceof UploadedFile) { diff --git a/app/Settings/SystemSettings.php b/app/Settings/SystemSettings.php index 1779547..8c0f75b 100644 --- a/app/Settings/SystemSettings.php +++ b/app/Settings/SystemSettings.php @@ -8,11 +8,13 @@ class SystemSettings extends Settings { public string $app_name; - public ?string $about_app; + public string $about_app; - public ?string $email; + public string $email; - public ?string $phone; + public string $phone; + + public string $address; public static function group(): string { diff --git a/database/settings/2026_06_11_085959_create_app_settings.php b/database/settings/2026_06_11_085959_create_app_settings.php index 871e447..4f18177 100644 --- a/database/settings/2026_06_11_085959_create_app_settings.php +++ b/database/settings/2026_06_11_085959_create_app_settings.php @@ -9,11 +9,12 @@ public function up(): void { $this->migrator->inGroup('system', function (SettingsBlueprint $blueprint): void { $blueprint->add('app_name', config('app.name', 'DST Collection')); - $blueprint->add('about_app', null); - $blueprint->add('email', null); - $blueprint->add('phone', null); - $blueprint->add('logo', null); - $blueprint->add('login_cover', null); + $blueprint->add('address', 'Jl. Raya Cipeundeuy - Pabuaran No.909, Pabuaran, Kec. Pabuaran, Kabupaten Subang, Jawa Barat 41262'); + $blueprint->add('about_app', ''); + $blueprint->add('email', ''); + $blueprint->add('phone', ''); + $blueprint->add('logo', ''); + $blueprint->add('login_cover', ''); }); $this->migrator->inGroup('social_media', function (SettingsBlueprint $blueprint): void { diff --git a/resources/js/components/admin/setting/SystemSection.vue b/resources/js/components/admin/setting/SystemSection.vue index ead9177..b5850e0 100644 --- a/resources/js/components/admin/setting/SystemSection.vue +++ b/resources/js/components/admin/setting/SystemSection.vue @@ -20,6 +20,7 @@ const form = useForm({ about_app: props.data.about_app ?? '', email: props.data.email ?? '', phone: props.data.phone ?? '', + address: props.data.address ?? '', logo: null as File | null, login_cover: null as File | null, }); @@ -65,6 +66,15 @@ function submit() { + + + Alamat + +