first
This commit is contained in:
35
app/Http/Requests/Ppm/ApproveApplicationRequest.php
Normal file
35
app/Http/Requests/Ppm/ApproveApplicationRequest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Ppm;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ApproveApplicationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('PPM') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'approved_position_code' => ['required', Rule::in(['KTM', 'KP', 'KPDP', 'PAPM'])],
|
||||
'saluran_mengundi_id' => [
|
||||
Rule::requiredIf(fn (): bool => $this->input('approved_position_code') === 'KTM'),
|
||||
'nullable',
|
||||
'integer',
|
||||
],
|
||||
'ktm_assignment_id' => [
|
||||
Rule::requiredIf(fn (): bool => in_array($this->input('approved_position_code'), ['KP', 'KPDP'], true)),
|
||||
'nullable',
|
||||
'integer',
|
||||
],
|
||||
'note' => ['nullable', 'string', 'max:1000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
27
app/Http/Requests/Ppm/RecordAttendanceRequest.php
Normal file
27
app/Http/Requests/Ppm/RecordAttendanceRequest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Ppm;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class RecordAttendanceRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('PPM') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'attendance' => ['required', 'array'],
|
||||
'attendance.*.status' => ['required', Rule::in(['present', 'absent', 'not_recorded'])],
|
||||
'attendance.*.check_in_time' => ['nullable', 'date'],
|
||||
'attendance.*.note' => ['nullable', 'string', 'max:1000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Http/Requests/Ppm/RejectApplicationRequest.php
Normal file
23
app/Http/Requests/Ppm/RejectApplicationRequest.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Ppm;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RejectApplicationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('PPM') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'reason' => ['required', 'string', 'max:1000'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user