Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Foto::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(['idFoto' => $this->idFoto, 'idOcorrencia' => $this->idOcorrencia, 'idDenuncia' => $this->idDenuncia]);
     $query->andFilterWhere(['like', 'comentario', $this->comentario])->andFilterWhere(['like', 'endereco', $this->endereco]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Foto::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_foto' => $this->id_foto]);
     $query->andFilterWhere(['like', 'titutlo', $this->titutlo])->andFilterWhere(['like', 'link', $this->link]);
     return $dataProvider;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($album_id, $id)
 {
     //
     $foto = Foto::find($id);
     $checkfile = file_exists(public_path('upload/besar/' . $foto->foto_besar));
     $checkfile2 = file_exists(public_path('upload/kecil/' . $foto->foto_kecil));
     if ($checkfile) {
         unlink(public_path('upload/kecil/' . $foto->foto_kecil));
     }
     if ($checkfile2) {
         unlink(public_path('upload/besar/' . $foto->foto_besar));
     }
     if ($foto->delete()) {
         return response()->json(array('success' => TRUE));
     }
 }