> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:255'], 'url' => ['nullable', 'string', 'max:2048'], 'order_method' => ['nullable', 'in:email,online_shop'], 'order_email' => ['nullable', 'email', 'max:255'], 'order_url' => ['nullable', 'string', 'max:2048'], 'delivery_time' => ['nullable', 'string', 'max:255'], 'delivery_time_days' => ['nullable', 'integer', 'min:0', 'max:65535'], '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'), 'delivery_time_days' => $this->input('delivery_time_days', '') === '' ? null : $this->input('delivery_time_days'), ]); } }