front end fixes
This commit is contained in:
@@ -11,8 +11,35 @@ final class StoreProductRequest extends FormRequest
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'is_active' => $this->boolean('is_active'),
|
||||
'is_featured' => $this->boolean('is_featured'),
|
||||
'features' => collect(preg_split('/\r\n|\r|\n/', (string) $this->input('features')))
|
||||
->map(fn (string $feature) => trim($feature))
|
||||
->filter()
|
||||
->values()
|
||||
->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return ['name' => ['required', 'string', 'max:255'], 'is_active' => ['sometimes', 'boolean']];
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'product_type' => ['required', 'in:product,plan'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'price' => ['nullable', 'numeric', 'min:0'],
|
||||
'currency' => ['required', 'string', 'size:3'],
|
||||
'billing_period' => ['nullable', 'string', 'max:40'],
|
||||
'features' => ['array'],
|
||||
'features.*' => ['string', 'max:255'],
|
||||
'cta_label' => ['nullable', 'string', 'max:80'],
|
||||
'cta_url' => ['nullable', 'string', 'max:2048'],
|
||||
'is_featured' => ['boolean'],
|
||||
'sort_order' => ['integer', 'min:0'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user