예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tender::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => []]);
     $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(['tender_id' => $this->tender_id, 'date_start' => $this->date_start, 'date_end' => $this->date_end, 'price' => $this->price, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'user_id' => $this->user_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'info', $this->info])->andFilterWhere(['like', 'file', $this->file]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function publish($id)
 {
     $pub = Tender::find($id);
     $pub->update(['is_published' => $pub->is_published ? 0 : 1]);
     return Redirect::route('tenders.admin');
 }