| Current Path : /var/www/html/LLCF-APP/app/Http/Requests/ |
| Current File : /var/www/html/LLCF-APP/app/Http/Requests/UpdateVtcStudentAcademicRecordRequest.php |
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateVtcStudentAcademicRecordRequest extends FormRequest
{
public function authorize(): bool
{
return auth()->guard('admin')->check();
}
public function rules(): array
{
$id = $this->route('id');
return [
'id' => 'required|exists:vtc_student_academic_records,id',
'vtc_student_id' => 'required|exists:vtc_students,id',
'institute_name' => 'required|string|min:3|max:255',
'qualification' => 'required|string|min:3|max:255',
'year' => 'required|integer|min:4',
];
}
public function prepareForValidation(): void
{
$this->merge([
'id' => $this->route('id'),
]);
}
public function messages(): array
{
return [
'id.required' => 'Invalid academic record.',
'id.exists' => 'The selected academic record does not exist.',
'vtc_student_id.required' => 'Please select a student.',
'vtc_student_id.exists' => 'Selected student does not exist.',
'institution_name.required' => 'Please enter institution name.',
];
}
}