Пример #1
0
 /**
  * @inheritDoc
  */
 public static function conversations($userId)
 {
     return parent::conversations($userId)->with(['contact' => function ($contact) {
         /**@var $contact ActiveQuery * */
         $contact->with(['profile' => function ($advanced) {
             /**@var $advanced ActiveQuery * */
             $advanced->select(['id', 'CONCAT_WS(\' \', first_name, last_name) AS full_name', 'avatar']);
         }])->select(['id', 'email']);
     }]);
 }
Пример #2
0
 /**
  * @inheritDoc
  */
 public static function conversations($userId)
 {
     return parent::conversations($userId)->with(['contact' => function ($contact) {
         /**@var $contact ActiveQuery * */
         $contact->with(['profile' => function ($profile) {
             /**@var $profile ActiveQuery * */
             $profile->select(['id', 'name' => new Expression('CONCAT_WS(\' \', first_name, last_name)'), 'avatar']);
         }])->select(['id']);
     }, 'newMessages' => function ($msg) use($userId) {
         /**@var $msg ActiveQuery * */
         $msg->andOnCondition(['receiver_id' => $userId])->select(['sender_id', 'count' => new Expression('COUNT(*)')]);
     }]);
 }
Пример #3
0
 /**
  * @return string
  */
 public function getModelClass()
 {
     return Model::className();
 }