front end fixes

This commit is contained in:
Mark Gregory
2026-07-27 07:37:11 +01:00
parent 0be7be48e7
commit 108f95dbfa
21 changed files with 687 additions and 423 deletions
@@ -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'],
];
}
}