42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
||
|
||
namespace App\Http\Requests\Preview;
|
||
|
||
use Illuminate\Foundation\Http\FormRequest;
|
||
|
||
class StorePreviewRequest extends FormRequest
|
||
{
|
||
public function authorize(): bool
|
||
{
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* @return array<string, array<int, string>>
|
||
*/
|
||
public function rules(): array
|
||
{
|
||
return [
|
||
'page_id' => ['required', 'integer', 'exists:pages,id'],
|
||
'blocks' => ['present', 'array'],
|
||
'blocks.*.type' => ['required', 'string', 'max:50'],
|
||
'blocks.*.content' => ['present', 'array'],
|
||
'blocks.*.order_index' => ['required', 'integer', 'min:0'],
|
||
];
|
||
}
|
||
|
||
/**
|
||
* @return array<string, string>
|
||
*/
|
||
public function messages(): array
|
||
{
|
||
return [
|
||
'page_id.required' => 'Sayfa ID zorunludur.',
|
||
'page_id.exists' => 'Geçersiz sayfa.',
|
||
'blocks.present' => 'Bloklar alanı gereklidir.',
|
||
'blocks.*.type.required' => 'Blok tipi zorunludur.',
|
||
'blocks.*.order_index.required' => 'Blok sırası zorunludur.',
|
||
];
|
||
}
|
||
}
|