Skip to content

Models

Ringkasan

Eloquent models diorganisir per domain di app/Models/. Setiap direktori domain berisi file model dan opsional subdirektori Concerns/.


Struktur Folder

app/Models/
├── Academic/              # Domain akademik
├── Recruitment/           # Domain rekrutmen
├── Platform/              # Model bersama (User, Asset, Setting)
├── Institution/           # Sekolah, kelas, guru
├── Financial/             # Keuangan
├── Geographic/            # Wilayah, kota
├── News/                  # Artikel, berita
└── ...

Konvensi

AturanContoh
Namespace: App\Models\{Domain}\{Model}App\Models\Recruitment\Candidate
Table name: snake_case pluralcandidates
Primary key: UUID (v4)$table->uuid('id')->primary()
Timestamps: selalu$table->timestamps()

Traits Umum

TraitFungsi
HasLocalizationResolve JSON kolom terlokalisasi
HasContactAttachment kontak via tabel master
HasLogAudit logging otomatis
HasAssetRelasi dinamis ke tabel assets

File Penting

FileTujuan
app/Models/{Domain}/*.phpModel per domain
app/Traits/Common/Shared traits