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,36 @@
<?php
namespace App\Http\Requests\Ktm;
use Illuminate\Foundation\Http\FormRequest;
class RegisterKpApplicantRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user()?->hasRole('KTM') === 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')),
]);
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'ktm_assignment_id' => ['required', 'integer', 'exists:staff_assignments,id'],
'name' => ['required', 'string', 'max:255'],
'ic_number' => ['required', 'digits:12'],
'phone_number' => ['required', 'string', 'max:30'],
'email' => ['required', 'email', 'max:255'],
'address' => ['nullable', 'string', 'max:1000'],
];
}
}