| 1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Http\Requests;
- use App\Enums\SupportRequestCategoryEnum;
- use App\Enums\SupportRequestStatusEnum;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rule;
- class SupportRequestRequest extends FormRequest
- {
- public function rules(): array
- {
- if ($this->isMethod('PUT') || $this->isMethod('PATCH')) {
- return [
- 'status' => ['required', Rule::in(SupportRequestStatusEnum::toArray())],
- ];
- }
- return [
- 'category' => ['required', Rule::in(SupportRequestCategoryEnum::toArray())],
- 'title' => ['required', 'string', 'max:150'],
- 'message' => ['required', 'string', 'max:8000'],
- 'name' => ['sometimes', 'nullable', 'string', 'max:255'],
- 'email' => ['sometimes', 'nullable', 'email', 'max:255'],
- 'phone' => ['sometimes', 'nullable', 'string', 'max:30'],
- ];
- }
- }
|