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 getFormattedNipNimAttribute() { return $this->nip_nim ? strtoupper($this->nip_nim) : null; } public function hasActiveBorrow() { return $this->borrowTransactions() ->whereIn('status', ['dipinjam', 'menunggu', 'disetujui']) ->exists(); } }