public static function findIdentity($id)
{
return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
}
/** * Lists all ApiLogs models. * @return mixed */ public function actionIndex() { $user = User::findIdentity(Yii::$app->user->id); $user->level == 1 ? $searchModel = new ApiLogsSearch() : ($searchModel = new UserApiLogsSearch()); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }