182 lines
5.3 KiB
PHP
182 lines
5.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\Lpj\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class FormSurveyorRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$commonRules = $this->getCommonRules();
|
|
$actionSpecificRules = $this->getActionSpecificRules();
|
|
|
|
return array_merge($commonRules, $actionSpecificRules);
|
|
}
|
|
|
|
/**
|
|
* Get common rules that apply to all actions.
|
|
*/
|
|
private function getCommonRules(): array
|
|
{
|
|
return [
|
|
'jenis_jaminan_id' => 'required',
|
|
'type' => 'required',
|
|
'permohonan_id' => 'required',
|
|
'luas' => 'required',
|
|
'jarak_jalan_utama' => 'required',
|
|
'alamat' => 'required',
|
|
'jarak_cbd_point' => 'required',
|
|
'lebar_perkerasan_jalan' => 'required',
|
|
'perkerasan_jalan' => 'required',
|
|
'lalu_lintas' => 'required',
|
|
'gol_mas_sekitar' => 'required',
|
|
'tingkat_keramaian' => 'required',
|
|
'terletak_diarea' => 'required',
|
|
'disekitar_lokasi' => 'required',
|
|
'dekat_makam' => 'required',
|
|
'dekat_tps' => 'required',
|
|
'merupakan_daerah' => 'required',
|
|
'fasilitas_dekat_object' => 'required',
|
|
'fakta_positif' => 'required',
|
|
'fakta_negatif' => 'required',
|
|
'rute_menuju' => 'required',
|
|
'batas_batas' => 'required',
|
|
'kondisi_linkungan' => 'required',
|
|
'kondisi_lain_bangunan' => 'required',
|
|
'informasi_dokument' => 'required',
|
|
'peruntukan' => 'required',
|
|
'kdb' => 'required',
|
|
'kdh' => 'required',
|
|
'gsb' => 'required',
|
|
'max_lantai' => 'required',
|
|
'klb' => 'required',
|
|
'gss' => 'required',
|
|
'pelebaran_jalan' => 'required',
|
|
'nama_petugas' => 'required',
|
|
'lat' => 'required|numeric',
|
|
'lng' => 'required|numeric',
|
|
'foto_tempat' => 'required',
|
|
'keterangan' => 'required',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get rules specific to the action.
|
|
*/
|
|
private function getActionSpecificRules(): array
|
|
{
|
|
$action = $this->input('action');
|
|
|
|
switch ($action) {
|
|
case 'tanah':
|
|
return $this->getTanahBangunanRules();
|
|
case 'unit':
|
|
return $this->getUnitRules();
|
|
case 'kapal':
|
|
return $this->getUnitRules();
|
|
case 'kendaraan':
|
|
return $this->getUnitRules();
|
|
case 'mesin':
|
|
return $this->getUnitRules();
|
|
case 'bangunan':
|
|
return $this->getTanahBangunanRules();
|
|
case 'tanah_bangunan':
|
|
return $this->getTanahBangunanRules();
|
|
case 'alat-berat':
|
|
return $this->getUnitRules();
|
|
default:
|
|
return [];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Get rules specific to tanah_bangunan action.
|
|
*/
|
|
private function getTanahBangunanRules(): array
|
|
{
|
|
return [
|
|
'action' => 'required',
|
|
'bentuk_tanah' => 'required',
|
|
'kontur_tanah' => 'required',
|
|
'posisi_kavling' => 'required',
|
|
'ketinggian_jalan' => 'required',
|
|
'kondisi_fisik_tanah' => 'required',
|
|
'kontur_jalan' => 'required',
|
|
'kondisi_bangunan' => 'required',
|
|
'sifat_bangunan' => 'required',
|
|
'sarana_pelengkap' => 'required',
|
|
'luas_tanah_bagunan' => 'required',
|
|
'tusuk_sate' => 'required',
|
|
'name.*' => 'required|string',
|
|
'kategori.*' => 'required|string',
|
|
'lockland' => 'required',
|
|
'jenis_bangunan' => 'required',
|
|
'kondisi_bangunan' => 'required',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get rules specific to unit action.
|
|
*/
|
|
private function getUnitRules(): array
|
|
{
|
|
return [
|
|
'action' => 'required',
|
|
'jenis_unit' => 'required',
|
|
'kondisi_unit' => 'required',
|
|
'posisi_unit' => 'required',
|
|
'lantai' => 'required',
|
|
'view' => 'required',
|
|
'bentuk_unit' => 'required',
|
|
];
|
|
}
|
|
|
|
|
|
|
|
private function getKapalRules():array{
|
|
return [
|
|
'action' => 'required',
|
|
'kondisi_kapal' => 'required',
|
|
'kondisi_kapal_lain' => 'required',
|
|
];
|
|
}
|
|
|
|
public function getKendaraanRules():array{
|
|
return [
|
|
'action' => 'required',
|
|
'kondisi_kendaraan' => 'required',
|
|
'kondisi_kendaraan_lain' => 'required',
|
|
];
|
|
}
|
|
|
|
|
|
public function getMesinRules():array{
|
|
return [
|
|
'action' => 'required',
|
|
'kondisi_mesin' => 'required',
|
|
'kondisi_mesin_lain' => 'required',
|
|
];
|
|
}
|
|
|
|
|
|
public function getAlatBeratRules():array{
|
|
return [
|
|
'action' => 'required',
|
|
'kondisi_alat_berat' => 'required',
|
|
'kondisi_alat_berat_lain' => 'required',
|
|
];
|
|
}
|
|
}
|