initial commit

This commit is contained in:
2026-09-23 12:45:02 +07:00
parent d16f454083
commit 507fc6ccdf
235 changed files with 19587 additions and 2835 deletions
+5 -7
View File
@@ -25,7 +25,7 @@ class Matting extends Model
}
/**
* SINKRONISASI OTOMATIS (The Engine)
* SINKRONISASI OTOMATIS (Mesin sinkronisasi)
* Saat data Matting disimpan, otomatis update data di tabel Cats.
*/
protected static function booted()
@@ -34,8 +34,7 @@ class Matting extends Model
// 1. Update data Sire (Bapak)
if ($matting->sire_id && $matting->sire) {
$matting->sire->update([
'pedigree' => $matting->no_pedigree_bapak,
'microchip' => $now_microchip_bapak ?? $matting->no_microchip_bapak,
'microchip' => $matting->no_microchip_bapak,
'tanggal_lahir' => $matting->tgl_lahir_sire,
// Pastikan kolom di tabel 'mattings' adalah ems_bapak
'kode_ems' => $matting->ems_bapak,
@@ -45,7 +44,6 @@ class Matting extends Model
// 2. Update data Dam (Ibu)
if ($matting->dam_id && $matting->dam) {
$matting->dam->update([
'pedigree' => $matting->no_pedigree_ibu,
'microchip' => $matting->no_microchip_ibu,
'tanggal_lahir' => $matting->tgl_lahir_dam,
// Pastikan kolom di tabel 'mattings' adalah ems_ibu
@@ -74,7 +72,7 @@ class Matting extends Model
}
/* -------------------------------------------------------------------------- */
/* ACCESSORS (UI & Breeding Intelligence) */
/* ACCESSORS (UI & BREEDING) */
/* -------------------------------------------------------------------------- */
/**
@@ -114,7 +112,7 @@ class Matting extends Model
get: function () {
$status = strtolower($this->status);
return match($status) {
'proses' => '<span class="px-3 py-1 bg-blue-50 text-blue-600 rounded-full text-[10px] font-black uppercase border border-blue-100">Monitoring</span>',
'proses' => '<span class="px-3 py-1 bg-blue-50 text-blue-600 rounded-full text-[10px] font-black uppercase border border-blue-100">Dipantau</span>',
'berhasil' => '<span class="px-3 py-1 bg-emerald-50 text-emerald-600 rounded-full text-[10px] font-black uppercase border border-emerald-100">Lahir</span>',
'gagal' => '<span class="px-3 py-1 bg-rose-50 text-rose-600 rounded-full text-[10px] font-black uppercase border border-rose-100">Gagal</span>',
default => '<span class="px-3 py-1 bg-slate-50 text-slate-600 rounded-full text-[10px] font-black uppercase">'.$status.'</span>',
@@ -131,7 +129,7 @@ class Matting extends Model
// Pastikan kolom di tabel 'mattings' adalah 'user_id'
// Jika kolomnya bernama 'pic_id', ganti 'user_id' menjadi 'pic_id'
return $this->belongsTo(User::class, 'user_id')->withDefault([
'name' => 'System / Admin'
'name' => 'Sistem / Admin'
]);
}
}