- ProgramController: full CRUD, publish, close, delete (guarded if attendance exists) - StoreProgramRequest + UpdateProgramRequest with Malay attribute names - AuditLogService: logs admin actions, redacts sensitive fields (no_kp, token, password) - Program index: search, status filter, pagination (Bootstrap 5) - Program create/edit: shared _form partial with all fields (dates, sessions, walk-in toggle) - Program show: tab layout (participants, qr, template, questionnaire, statistics) - Bootstrap 5 pagination via Paginator::useBootstrapFive() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
2.2 KiB
PHP
57 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreProgramRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return auth()->check();
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'title' => ['required', 'string', 'max:255'],
|
|
'description' => ['nullable', 'string', 'max:5000'],
|
|
'organizer' => ['required', 'string', 'max:255'],
|
|
'location' => ['required', 'string', 'max:500'],
|
|
'start_date' => ['required', 'date'],
|
|
'end_date' => ['required', 'date', 'gte:start_date'],
|
|
'checkin_start_at' => ['nullable', 'date'],
|
|
'checkin_end_at' => ['nullable', 'date', 'after_or_equal:checkin_start_at'],
|
|
'ecert_download_start_at' => ['nullable', 'date'],
|
|
'ecert_download_end_at' => ['nullable', 'date', 'after_or_equal:ecert_download_start_at'],
|
|
'allow_walk_in' => ['boolean'],
|
|
'default_staff_session' => ['nullable', 'in:pagi,petang,full_day'],
|
|
'default_external_session' => ['nullable', 'in:pagi,petang,full_day'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'title' => 'nama program',
|
|
'organizer' => 'penganjur',
|
|
'location' => 'lokasi',
|
|
'start_date' => 'tarikh mula',
|
|
'end_date' => 'tarikh tamat',
|
|
'checkin_start_at' => 'masa mula check-in',
|
|
'checkin_end_at' => 'masa tamat check-in',
|
|
'ecert_download_start_at' => 'masa mula download sijil',
|
|
'ecert_download_end_at' => 'masa tamat download sijil',
|
|
'default_staff_session' => 'sesi default kakitangan',
|
|
'default_external_session' => 'sesi default peserta luar',
|
|
];
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$this->merge([
|
|
'allow_walk_in' => $this->boolean('allow_walk_in'),
|
|
]);
|
|
}
|
|
}
|