/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $questionAnswer = QuestionAnswer::find($id);
     if (!$questionAnswer) {
         return $this->respondNotFound('Item Not Found');
     }
     return $this->respond(['data' => [$this->questionAnswerTransformer->transform($questionAnswer)]]);
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = QuestionAnswer::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_av' => $this->id_av, 'id_q' => $this->id_q, 'npp' => $this->npp, 'isHidden' => $this->isHidden, 'hasText' => $this->hasText, 'textMaxLength' => $this->textMaxLength, 'isNoRandomized' => $this->isNoRandomized]);
     $query->andFilterWhere(['like', 'separator', $this->separator])->andFilterWhere(['like', 'name_ua', $this->name_ua])->andFilterWhere(['like', 'name_ru', $this->name_ru]);
     return $dataProvider;
 }