dstpabuaran.com/app/Http/Requests/Admin/SDM/EmployeeRequest.php
Yoga Pangestu 887526bd18 feat: add employee management features including create, edit, and list functionalities
- Implemented employee creation and editing forms with validation.
- Added employee listing with actions for edit, delete, and reset password.
- Integrated toggle for employee active status.
- Created reusable UI components for forms, alerts, and data tables.
- Updated routing to include employee management endpoints.
2026-07-29 22:26:24 +07:00

62 lines
1.9 KiB
PHP

<?php
namespace App\Http\Requests\Admin\SDM;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class EmployeeRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
$userId = $this->route('employee')?->id;
return [
'email' => [
'required',
'email',
'max:100',
Rule::unique('users', 'email')->ignore($userId, 'id'),
],
'username' => [
'required',
'string',
'max:20',
'alpha_dash',
Rule::unique('users', 'username')->ignore($userId, 'id'),
],
'full_name' => ['required', 'string', 'max:200'],
'phone_number' => ['nullable', 'string', 'max:20'],
'gender' => ['nullable', 'in:male,female'],
'birth_date' => ['nullable', 'date'],
'address' => ['nullable', 'string'],
'join_date' => ['required', 'date'],
'resign_date' => ['nullable', 'date', 'after_or_equal:join_date'],
'employment_status' => ['required', Rule::in(['full_time', 'part_time', 'contract', 'internship', 'resigned'])],
'base_salary' => ['required', 'integer', 'min:0'],
];
}
public function attributes(): array
{
return [
'email' => 'Email',
'username' => 'Username',
'full_name' => 'Nama Lengkap',
'phone_number' => 'Nomor HP',
'gender' => 'Jenis Kelamin',
'birth_date' => 'Tanggal Lahir',
'address' => 'Alamat',
'join_date' => 'Tanggal Masuk',
'resign_date' => 'Tanggal Keluar',
'employment_status' => 'Status Kepegawaian',
'base_salary' => 'Gaji Pokok',
];
}
}