27 lines
663 B
PHP
27 lines
663 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Manage\CourseRegistration;
|
|
|
|
use App\Enums\UserRole;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateCourseRegistrationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
$student = $this->route('student');
|
|
|
|
return $this->user()->hasRole(UserRole::Mahasiswa->value)
|
|
&& $this->user()->student?->id === $student?->id;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'course_class_ids' => ['array'],
|
|
'course_class_ids.*' => ['integer'],
|
|
'signature' => ['nullable', 'file', 'image', 'max:2048'],
|
|
];
|
|
}
|
|
}
|