src/apis/CommonController.php
public function actionLastLogins()
    {
        return UserLogin::find()->select(['user_id', 'max(timestamp_create) as maxdate'])->joinWith(['user' => function ($q) {
            $q->select(['id', 'firstname', 'lastname']);
        }])->limit(10)->groupBy(['user_id'])->orderBy(['maxdate' => SORT_DESC])->asArray()->all();
    }
public function actionLastLogins()
    {
        return UserLogin::find()->select(['user_id', 'max(timestamp_create) as maxdate'])->joinWith(['user' => function ($q) {
            $q->select(['id', 'firstname', 'lastname']);
        }])->limit(10)->groupBy(['user_id'])->orderBy(['maxdate' => SORT_DESC])->asArray()->all();
    }
public function actionLastLogins ( ) { return UserLogin :: find ( ) -> select ( [ 'user_id' , 'max(timestamp_create) as maxdate' ] ) -> joinWith ( [ 'user' => function ( $ q ) { $ q -> select ( [ 'id' , 'firstname' , 'lastname' ] ) ; } ] ) -> limit ( 10 ) -> groupBy ( [ 'user_id' ] ) -> orderBy ( [ 'maxdate' => SORT_DESC ] ) -> asArray ( ) -> all ( ) ; }
Last User logins
@return array|\yii\db\ActiveRecord[]
Last User logins