'integer' ]; /** * Relationship ke User */ public function user() { return $this->belongsTo(User::class); } /** * Relationship ke Kontrakan */ public function kontrakan() { return $this->belongsTo(Kontrakan::class, 'item_id'); } /** * Relationship ke Laundry */ public function laundry() { return $this->belongsTo(Laundry::class, 'item_id'); } /** * Scope untuk query review by type & item */ public function scopeForItem($query, $type, $itemId) { return $query->where('type', $type) ->where('item_id', $itemId) ->with('user') ->latest(); } }