This commit is contained in:
Saufi
2026-06-03 08:51:22 +08:00
commit a14d43fe34
347 changed files with 38197 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Requests\Admin\Management;
use Illuminate\Foundation\Http\FormRequest;
class StoreManualApplicationRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user()?->hasRole('Admin') === true;
}
protected function prepareForValidation(): void
{
$this->merge([
'ic_number' => preg_replace('/\D+/', '', (string) $this->input('ic_number')),
'phone_number' => trim((string) $this->input('phone_number')),
'email' => blank($this->input('email')) ? null : strtolower(trim((string) $this->input('email'))),
'selected_ktm_assignment_id' => blank($this->input('selected_ktm_assignment_id')) ? null : $this->input('selected_ktm_assignment_id'),
'bank_name' => blank($this->input('bank_name')) ? null : trim((string) $this->input('bank_name')),
'bank_account_number' => blank($this->input('bank_account_number')) ? null : preg_replace('/\D+/', '', (string) $this->input('bank_account_number')),
]);
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'election_id' => ['required', 'integer', 'exists:elections,id'],
'pusat_mengundi_id' => ['required', 'integer', 'exists:pusat_mengundis,id'],
'selected_ktm_assignment_id' => ['nullable', 'integer', 'exists:staff_assignments,id'],
'requested_position_id' => ['required', 'integer', 'exists:positions,id'],
'name' => ['required', 'string', 'max:255'],
'ic_number' => ['required', 'digits:12'],
'phone_number' => ['required', 'string', 'max:30'],
'email' => ['nullable', 'email', 'max:255'],
'address' => ['nullable', 'string', 'max:2000'],
'bank_name' => ['nullable', 'string', 'max:255'],
'bank_account_number' => ['nullable', 'string', 'max:50'],
'note' => ['nullable', 'string', 'max:2000'],
];
}
}