hasMany(BorrowTransaction::class, 'anggota_id'); } public function user() { return $this->belongsTo(User::class, 'user_id'); } public function getFormattedNameAttribute() { return ucwords(strtolower($this->nama)); } public function getFormattedNikNipAttribute() { return $this->nik_nip ? strtoupper($this->nik_nip) : null; } public function hasActiveBorrow() { return $this->borrowTransactions() ->whereIn('status', ['dipinjam', 'menunggu', 'disetujui']) ->exists(); } }