Update Koperasi
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Koperasi;
|
||||
|
||||
use App\Enums\Koperasi\FokusKomoditasKoperasi;
|
||||
use App\Enums\Koperasi\JenisKoperasi;
|
||||
use App\Enums\Koperasi\PosisiKoperasi;
|
||||
use App\Enums\Koperasi\SkalaOperasiKoperasi;
|
||||
use App\Services\Koperasi\WilayahKoperasiService;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StorePengurusKoperasiRequest extends KoperasiRequest
|
||||
{
|
||||
use ValidatesWilayahKoperasi;
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
parent::prepareForValidation();
|
||||
if (app(WilayahKoperasiService::class)->available() && $this->exists('provinsi_id') && ! $this->exists('desa_kelurahan_id')) {
|
||||
$this->merge(['desa_kelurahan_id' => null]);
|
||||
}
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
...$this->wilayahRules(true),
|
||||
'nama_lengkap' => ['required', 'string', 'max:255'],
|
||||
'posisi_dalam_koperasi' => ['required', Rule::enum(PosisiKoperasi::class)],
|
||||
'tahun_bergabung' => ['nullable', 'integer'],
|
||||
'no_hp' => ['nullable', 'string', 'max:20'],
|
||||
'alamat_tinggal' => ['nullable', 'string'],
|
||||
'nama_koperasi' => ['required', 'string', 'max:255'],
|
||||
'jenis_koperasi' => ['required', Rule::enum(JenisKoperasi::class)],
|
||||
'jenis_koperasi_lainnya' => ['nullable', 'string', 'max:255'],
|
||||
'alamat_koperasi' => ['nullable', 'string'],
|
||||
'sejarah_lembaga' => ['nullable', 'string'],
|
||||
'fokus_komoditas' => ['nullable', Rule::enum(FokusKomoditasKoperasi::class)],
|
||||
'detail_fokus_komoditas' => ['nullable', 'string', 'max:255'],
|
||||
'skala_operasi' => ['required', Rule::enum(SkalaOperasiKoperasi::class)],
|
||||
'tahun_berdiri' => ['nullable', 'integer'],
|
||||
'jumlah_anggota_awal' => ['nullable', 'integer'],
|
||||
'jumlah_anggota_dewasa' => ['nullable', 'integer'],
|
||||
'jumlah_anggota_anak' => ['nullable', 'integer'],
|
||||
'jumlah_pengurus' => ['nullable', 'integer'],
|
||||
'shu_2025' => ['nullable', 'numeric'],
|
||||
'shu_2024' => ['nullable', 'numeric'],
|
||||
'shu_2023' => ['nullable', 'numeric'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
...$this->wilayahAttributes(),
|
||||
'nama_lengkap' => 'Nama responden',
|
||||
'posisi_dalam_koperasi' => 'Posisi dalam koperasi',
|
||||
'tahun_bergabung' => 'Tahun bergabung koperasi',
|
||||
'no_hp' => 'Nomor HP',
|
||||
'alamat_tinggal' => 'Alamat tinggal',
|
||||
'nama_koperasi' => 'Nama koperasi',
|
||||
'jenis_koperasi' => 'Jenis koperasi',
|
||||
'jenis_koperasi_lainnya' => 'Jenis koperasi lainnya',
|
||||
'alamat_koperasi' => 'Alamat koperasi',
|
||||
'sejarah_lembaga' => 'Sejarah dan tujuan pendirian',
|
||||
'fokus_komoditas' => 'Fokus komoditas pertanian',
|
||||
'detail_fokus_komoditas' => 'Komoditas yang dikembangkan',
|
||||
'skala_operasi' => 'Skala operasi koperasi',
|
||||
'tahun_berdiri' => 'Tahun berdiri',
|
||||
'jumlah_anggota_awal' => 'Jumlah anggota awal berdiri',
|
||||
'jumlah_anggota_dewasa' => 'Jumlah anggota dewasa',
|
||||
'jumlah_anggota_anak' => 'Jumlah anggota anak',
|
||||
'jumlah_pengurus' => 'Jumlah pengurus',
|
||||
'shu_2025' => 'SHU 2025',
|
||||
'shu_2024' => 'SHU 2024',
|
||||
'shu_2023' => 'SHU 2023',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user