Ejemplo n.º 1
0
 /**
  * @param $name
  * @return Service
  * @throws NotFoundHttpException
  */
 protected function findModel($name)
 {
     if (($model = Service::findOne(['model_name' => $name])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Service::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, 'minimum_all_likes' => $this->minimum_all_likes, 'minimum_tasks' => $this->minimum_tasks, 'minimum_likes_per_task' => $this->minimum_likes_per_task, 'price_per_one_task' => $this->price_per_one_task]);
     $query->andFilterWhere(['like', 'model_name', $this->model_name])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }