Some checks failed
tests / ci (pull_request) Has been cancelled
- Created sub-namespaces under Admin\Manage for Course, Academic, Announcement, Finance, and Service. - Added new FormRequest classes for handling validation in each sub-namespace. - Implemented Service classes for managing business logic related to each resource. - Updated routes to reflect the new sub-namespace structure. - Enhanced code organization and maintainability by grouping related functionalities.
31 lines
811 B
PHP
31 lines
811 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Manage\Course;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class CourseRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'code' => [
|
|
'required',
|
|
'string',
|
|
'max:20',
|
|
Rule::unique('courses')->ignore($this->route('course')),
|
|
],
|
|
'name' => ['required', 'string', 'max:150'],
|
|
'credits' => ['required', 'integer', 'min:1', 'max:10'],
|
|
'department_id' => ['required', 'integer', Rule::exists('departments', 'id')],
|
|
'semester_number' => ['nullable', 'integer', 'min:1', 'max:14'],
|
|
];
|
|
}
|
|
}
|