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

43 lines
1.2 KiB
PHP
Raw Permalink 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\Schedule;
use Illuminate\Foundation\Http\FormRequest;
class UpdateScheduleRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, array<int, string>>
*/
public function rules(): array
{
return [
'course_id' => ['sometimes', 'integer', 'exists:courses,id'],
'start_date' => ['sometimes', 'date'],
'end_date' => ['sometimes', 'date', 'after:start_date'],
'location' => ['sometimes', 'string', 'max:255'],
'quota' => ['sometimes', 'integer', 'min:1'],
'available_seats' => ['sometimes', 'integer', 'min:0', 'lte:quota'],
'is_urgent' => ['sometimes', 'boolean'],
];
}
/**
* @return array<string, string>
*/
public function messages(): array
{
return [
'course_id.exists' => 'Seçilen eğitim bulunamadı.',
'end_date.after' => 'Bitiş tarihi başlangıçtan sonra olmalıdır.',
'quota.min' => 'Kontenjan en az 1 olmalıdır.',
'available_seats.lte' => 'Müsait koltuk sayısı kontenjandan fazla olamaz.',
];
}
}