public function getVenueTypeOptions() { $raw = VenueType::find()->all(); $arr = array(); foreach ($raw as $row) { $arr[$row['id']] = $row['name']; } return $arr; }
/** * Lists all VenueType models. * @return mixed */ public function actionIndex() { if (Yii::$app->user->can('venueTypeIndex')) { $dataProvider = new ActiveDataProvider(['query' => VenueType::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); } else { if (Yii::$app->user->isGuest) { Yii::$app->user->loginRequired(); } else { throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.')); } } }