Some checks failed
tests / ci (pull_request) Has been cancelled
- Added Semester enum with labels for odd and even semesters. - Created AcademicTerm model, controller, service, and request for handling academic terms. - Implemented paginated listing, creation, updating, and deletion of academic terms. - Added routes for academic terms management under admin/master. - Created frontend components for displaying and managing academic terms, including forms and data tables. - Integrated confirmation dialog for delete actions and form dialogs for creating and editing academic terms. - Added seeder for initial academic term data.
37 lines
934 B
PHP
37 lines
934 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class PaginatedRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'per_page' => ['nullable', 'integer', 'in:25,50,100,999999'],
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
'sort' => ['nullable', 'string'],
|
|
'direction' => ['nullable', 'string', 'in:asc,desc'],
|
|
'highlight' => ['nullable', 'integer'],
|
|
];
|
|
}
|
|
|
|
public function validatedWithDefaults(): array
|
|
{
|
|
$validated = $this->validated();
|
|
|
|
return [
|
|
'perPage' => $validated['per_page'] ?? 25,
|
|
'search' => $validated['search'] ?? '',
|
|
'sort' => $validated['sort'] ?? 'created_at',
|
|
'direction' => $validated['direction'] ?? 'desc',
|
|
];
|
|
}
|
|
}
|