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

47 lines
1.3 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\Menu;
use App\Enums\MenuLocation;
use App\Enums\MenuType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class StoreMenuRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, array<int, mixed>>
*/
public function rules(): array
{
return [
'label' => ['required', 'string', 'max:255'],
'url' => ['required', 'string', 'max:255'],
'location' => ['required', 'string', Rule::enum(MenuLocation::class)],
'type' => ['required', 'string', Rule::enum(MenuType::class)],
'parent_id' => ['nullable', 'integer', 'exists:menus,id'],
'order_index' => ['sometimes', 'integer', 'min:0'],
'is_active' => ['sometimes', 'boolean'],
];
}
/**
* @return array<string, string>
*/
public function messages(): array
{
return [
'label.required' => 'Menü etiketi zorunludur.',
'url.required' => 'URL zorunludur.',
'location.required' => 'Menü konumu zorunludur.',
'type.required' => 'Menü tipi zorunludur.',
'parent_id.exists' => 'Üst menü bulunamadı.',
];
}
}