1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Http\Requests\API\CustomField;
- use App\Models\Enums\CustomFieldType;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Validation\Rules\Enum;
- class CreateOrUpdateRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- */
- public function authorize(): bool
- {
- return true;
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
- */
- public function rules(): array
- {
- return [
- 'key' => 'required',
- 'group' => 'required',
- 'type' => [
- 'required',
- new Enum(CustomFieldType::class),
- ],
- 'required' => 'in:0,1',
- 'label' => 'required|array',
- 'options' => 'array',
- ];
- }
- }
|