public function run() { $hits = NULL; $model = new PostSearch(); if ($model->load(Yii::$app->request->post())) { if ($model->searchstring !== '') { $hits = Post::searchByString($model->searchstring)->all(); } } echo $this->render('@frenzelgmbh/sblog/widgets/views/_search', array('model' => $model, 'hits' => $hits)); }
/** * Lists all Post models. * @return mixed */ public function actionIndex() { $searchModel = new PostSearch(); $dataProvider = $searchModel->search($_GET); return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); }