> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'url' => ['nullable', 'string', 'max:2048'], 'contact_person' => ['nullable', 'string', 'max:255'], 'email' => ['nullable', 'email', 'max:255'], 'phone' => ['nullable', 'string', 'max:100'], 'country_id' => ['required', 'integer', 'exists:countries,id'], 'notes' => ['nullable', 'string'], 'active' => ['sometimes', 'boolean'], 'supplier_category_ids' => ['nullable', 'array'], 'supplier_category_ids.*' => ['integer', 'exists:supplier_categories,id'], ]; } protected function prepareForValidation(): void { $this->merge([ 'active' => $this->boolean('active'), ]); } }