From cb37de6da42c55c1ee018b7a539a9d0dbb0f634a Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Tue, 7 Apr 2026 17:30:34 +0200 Subject: [PATCH] Auto-generate company slug server-side in CompanyRequest CompanyRequest::getCompanyPayload() accepted 'slug' from the client but never generated it, so the installation wizard (which PUTs /api/v1/company) left the slug empty when setting up the first company. Match the sibling CompaniesRequest (which already does Str::slug($this->name)) and generate the slug from the name server-side; drop the now-unused 'slug' validation rule. Fixes the same bug that master's ed7af3fc tried to fix client-side with a lodash deburr + regex workaround in Step7CompanyInfo.vue. v3.0's installation wizard is a rewrite under resources/scripts/features/installation/CompanyView.vue and doesn't carry that workaround, so the cleaner fix is to make the backend authoritative like CompaniesRequest already is. --- app/Http/Requests/CompanyRequest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Requests/CompanyRequest.php b/app/Http/Requests/CompanyRequest.php index 5f3fb3b2..d0b818b9 100644 --- a/app/Http/Requests/CompanyRequest.php +++ b/app/Http/Requests/CompanyRequest.php @@ -3,6 +3,7 @@ namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Str; use Illuminate\Validation\Rule; class CompanyRequest extends FormRequest @@ -31,9 +32,6 @@ class CompanyRequest extends FormRequest 'tax_id' => [ 'nullable', ], - 'slug' => [ - 'nullable', - ], 'address.country_id' => [ 'required', ], @@ -45,10 +43,12 @@ class CompanyRequest extends FormRequest return collect($this->validated()) ->only([ 'name', - 'slug', 'vat_id', 'tax_id', ]) + ->merge([ + 'slug' => Str::slug($this->name), + ]) ->toArray(); } }