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
| Aturan | Contoh |
|---|---|
Namespace: App\Models\{Domain}\{Model} | App\Models\Recruitment\Candidate |
| Table name: snake_case plural | candidates |
| Primary key: UUID (v4) | $table->uuid('id')->primary() |
| Timestamps: selalu | $table->timestamps() |
Traits Umum
| Trait | Fungsi |
|---|---|
HasLocalization | Resolve JSON kolom terlokalisasi |
HasContact | Attachment kontak via tabel master |
HasLog | Audit logging otomatis |
HasAsset | Relasi dinamis ke tabel assets |
File Penting
| File | Tujuan |
|---|---|
app/Models/{Domain}/*.php | Model per domain |
app/Traits/Common/ | Shared traits |