public static function getAll() { $searchModel = new AuthItemSearch(['type' => Item::TYPE_PERMISSION]); $dataProvider = $searchModel->search(Yii::$app->getRequest()->getQueryParams()); $name = []; foreach ($dataProvider->allModels as $key => $item) { $name[] = ['name' => $item->name]; } return $name; }
/** * Lists all AuthItem models. * @return mixed */ public function actionIndex() { $searchModel = new AuthItemSearch(['type' => $this->type]); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams()); return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }