/** * Lists all Category models. * @return mixed */ public function actionIndex() { $searchModel = new CategorySearch(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams()); return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }
public static function getCategoryList($idCat = null) { $query = \biz\master\models\searchs\Category::find(); if ($idCat !== null) { $query->where(['id_category' => $idCat]); } return ArrayHelper::map($query->asArray()->all(), 'id_category', 'nm_category'); }