/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Organizacion::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, 'organizacionTipo_id' => $this->organizacionTipo_id]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'info', $this->info])->andFilterWhere(['like', 'imagen', $this->imagen])->andFilterWhere(['like', 'sitioWeb', $this->sitioWeb])->andFilterWhere(['like', 'nuestrasColecciones', $this->nuestrasColecciones])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'twitter', $this->twitter])->andFilterWhere(['like', 'instagram', $this->instagram])->andFilterWhere(['like', 'googleMas', $this->googleMas])->andFilterWhere(['like', 'linkedin', $this->linkedin])->andFilterWhere(['like', 'mapaLink', $this->mapaLink])->andFilterWhere(['like', 'pais', $this->pais])->andFilterWhere(['like', 'ciudad', $this->ciudad])->andFilterWhere(['like', 'provincia', $this->provincia])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'cp', $this->cp]);
     return $dataProvider;
 }
 /**
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function show($id)
 {
     try {
         $user = AuthenticateController::checkUser(null);
         return response()->json(Organizacion::find($id));
     } catch (QueryException $e) {
         return response()->json(['message' => 'server_error', 'exception' => $e->getMessage()], 500);
     } catch (Exceptions\TokenExpiredException $e) {
         return response()->json(['token_expired'], $e->getStatusCode());
     } catch (Exceptions\TokenInvalidException $e) {
         return response()->json(['token_invalid'], $e->getStatusCode());
     } catch (UnauthorizedException $e) {
         return response()->json(['unauthorized'], $e->getStatusCode());
     } catch (Exceptions\JWTException $e) {
         return response()->json(['token_absent'], $e->getStatusCode());
     }
 }
Beispiel #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdorganizacion0()
 {
     return $this->hasOne(Organizacion::className(), ['idorganizacion' => 'idorganizacion']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrganizacions()
 {
     return $this->hasMany(Organizacion::className(), ['organizacionTipo_id' => 'id']);
 }
 /**
  * Finds the Organizacion model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Organizacion the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Organizacion::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }