24 lines
678 B
PHP
24 lines
678 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Modules\CustomField\Requests;
|
||
|
|
|
||
|
|
use App\Modules\CustomField\Models\CustomFieldType;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rules\Enum;
|
||
|
|
|
||
|
|
class CreateCustomFieldDefinitionRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool { return true; }
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'label' => ['required', 'string', 'max:255'],
|
||
|
|
'type' => ['required', new Enum(CustomFieldType::class)],
|
||
|
|
'options' => ['nullable', 'array', 'required_if:type,select'],
|
||
|
|
'options.*' => ['string', 'max:255'],
|
||
|
|
'is_required' => ['boolean'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|