hasMany(RoomMemberModel::class, 'room_id', 'id'); } public function lastMessage() { return $this->hasOne(RoomMessageModel::class, 'room_id', 'id')->orderBy('created_at', 'desc'); } public function activity() { return $this->belongsTo(ActivityModel::class); } }