<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateStudentSubjectRequest extends FormRequest
{
    public function authorize(): bool
    {
        return auth()->check();
    }

    public function rules(): array
    {
        return [
            'editid' => ['required', 'integer', 'exists:sudentsubject,id'],
            'pagename' => [
                'required',
                'string',
                'max:200',
                Rule::unique('sudentsubject', 'subjectname')->ignore($this->integer('editid')),
            ],
            'pageorder' => ['nullable', 'integer', 'min:0', 'max:99'],
            'photoid' => ['nullable', 'integer', 'exists:attachements,id'],
        ];
    }
}
