static function getPortfolios($example = 0) { $return = Portfolio::find()->orderBy('id'); if ($example) { if (is_array($example)) { $return->where(['example_id' => $example]); } else { $return->where(['example_id' => $example]); } } //print_r($return); return $return; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Portfolio::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'port_image', $this->port_image]); return $dataProvider; }
/** * Displays homepage. * * @return mixed */ public function actionIndex() { $home = Home::find()->all(); $Portfolio = Portfolio::find()->all(); return $this->render('index', ['home' => $home, 'Portfolio' => $Portfolio]); }
/** * Lists all Portfolio models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Portfolio::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }