/** * @inheritdoc */ public function __construct($id = null, $config = null) { parent::__construct($config); if ($id) { // one user if ($user = UserRecord::findById($id)) { $this->user = $user; } else { throw new UserNotFoundException(); } } else { // all users $this->users = UserRecord::find(); } }
/** * Lists all User record models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => UserRecord::find()->where(['not', ['status' => UserRecord::STATUS_DELETED]])]); return $this->render('index', compact('dataProvider')); }