0

estoy buscando agregar un where más a la condición siguiente:

 $propiedadesObtenidas = Property::search($request->get('ubicacion'))
    ->where('tipoDePropiedad_id', '=', $tipoPropiedad_id[0])
    ->get();

Algo similar a:

$propiedadesObtenidas = Property::search($request->get('ubicacion'))
    ->where('tipoDePropiedad_id', '=', $tipoPropiedad_id[0])
    ->where('categoria_id', '=', $categoria_id)
    ->get();

¿ Alguien conoce como se puede agregar un parámetro más búsqueda ?

2
  • 2
    La segunda forma es la indicada, ¿qué error te da?
    – BetaM
    el 13 ago. 2020 a las 20:50
  • Pido disculpas me di cuenta que estaba pasando un string y necesitaba el id. Lo solucione obteniendo el id de la siguiente manera: $categoria_id = Category::where('nombre_categoria', $categoria)->pluck('id');
    – maraet
    el 13 ago. 2020 a las 21:01

1 respuesta 1

0

Pido disculpas me di cuenta que estaba pasando un string y necesitaba el id. Lo solucione obteniendo el id de la siguiente manera:

$categoria_id = Category::where('nombre_categoria', $categoria)->pluck('id');
0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.