Files
bogazici-api/app/Http/Requests/Preview/StorePreviewRequest.php
2026-03-27 10:41:54 +03:00

42 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.',
];
}
}