first commit

This commit is contained in:
Saufi
2026-06-24 20:32:14 +08:00
commit 10fb30ad69
201 changed files with 21356 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ConsultantRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user()->can('perunding.urus');
}
public function rules(): array
{
$consultantId = $this->route('consultant')?->id;
return [
'nama_perunding' => ['required', 'string', 'max:255'],
'no_pendaftaran_syarikat' => ['nullable', 'string', 'max:100'],
'alamat' => ['nullable', 'string', 'max:1000'],
'emel' => ['nullable', 'email', 'max:255'],
'telefon' => ['nullable', 'string', 'max:50'],
'aktif' => ['required', 'boolean'],
// Maklumat akaun pengguna perunding
'buat_akaun' => ['nullable', 'boolean'],
'user_name' => ['nullable', 'required_if:buat_akaun,1', 'string', 'max:255'],
'user_email' => [
'nullable', 'required_if:buat_akaun,1', 'email', 'max:255',
Rule::unique('users', 'email')->ignore($this->route('consultant')?->user_id),
],
'user_password' => ['nullable', 'required_if:buat_akaun,1', 'string', 'min:8'],
];
}
public function attributes(): array
{
return [
'nama_perunding' => 'nama perunding',
'no_pendaftaran_syarikat' => 'no pendaftaran syarikat',
'emel' => 'emel',
'telefon' => 'telefon',
'user_name' => 'nama pengguna',
'user_email' => 'emel akaun',
'user_password' => 'kata laluan akaun',
];
}
protected function prepareForValidation(): void
{
$this->merge([
'aktif' => $this->boolean('aktif'),
'buat_akaun' => $this->boolean('buat_akaun'),
]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class DataCentreRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user()->can('pusat_data.urus');
}
public function rules(): array
{
return [
'nama_pusat_data' => ['required', 'string', 'max:255'],
'tajuk_permohonan' => ['nullable', 'string', 'max:255'],
'lokasi_pusat_data' => ['nullable', 'string', 'max:255'],
'alamat' => ['nullable', 'string', 'max:1000'],
'keluasan_tapak' => ['nullable', 'numeric', 'min:0'],
'it_load' => ['nullable', 'numeric', 'min:0'],
'status' => ['required', 'in:aktif,tidak_aktif'],
];
}
public function attributes(): array
{
return [
'nama_pusat_data' => 'nama pusat data',
'tajuk_permohonan' => 'tajuk permohonan',
'lokasi_pusat_data' => 'lokasi pusat data',
'keluasan_tapak' => 'keluasan tapak',
'it_load' => 'kapasiti IT Load',
];
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ReportingCycleRequest extends FormRequest
{
public function authorize(): bool
{
return $this->user()->can('kitaran.urus');
}
public function rules(): array
{
$cycleId = $this->route('reporting_cycle')?->id;
return [
'renewal_year' => [
'required', 'integer', 'min:2000', 'max:2100',
Rule::unique('reporting_cycles', 'renewal_year')->ignore($cycleId),
],
'cut_off_date' => ['nullable', 'date'],
'licence_period_year' => ['required', 'integer', 'min:1', 'max:10'],
'checklist_template_id' => ['nullable', 'exists:checklist_templates,id'],
'status' => ['required', 'in:aktif,tutup'],
'catatan' => ['nullable', 'string', 'max:1000'],
];
}
public function attributes(): array
{
return [
'renewal_year' => 'tahun pembaharuan',
'cut_off_date' => 'tarikh tutup',
'licence_period_year' => 'tempoh lesen (tahun)',
];
}
}