protected static function baseQuery($userId) { return static::find()->forUser($userId)->addSelect(['user_id' => new Expression(':userId')])->with('lastMessage')->orderBy(['last_message_id' => SORT_DESC]); }
/** * @inheritDoc */ protected static function baseQuery($userId) { return parent::baseQuery($userId)->with(['newMessages', 'contact.profile']); }