siakad-itm/app/Http/Requests/PaginatedRequest.php
Yoga Pangestu 400e8d8c8a
Some checks failed
tests / ci (pull_request) Has been cancelled
feat: implement academic term management with CRUD functionality
- 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.
2026-08-05 13:48:36 +07:00

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',
];
}
}