34 lines
921 B
PHP
34 lines
921 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Admin\Content;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class StoreCustomFieldRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return $this->user() && $this->user()->hasPermission('edit-cpt');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'label' => 'required|string|max:255',
|
||
|
|
'name' => 'required|string|max:255',
|
||
|
|
'type' => 'required|string|in:text,textarea,media,date,select,checkbox,number',
|
||
|
|
'options' => 'nullable|array',
|
||
|
|
'required' => 'boolean',
|
||
|
|
'sort_order' => 'integer',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|