when I use join I skipped many records using eloquent with laravel

0

I am presenting an inconvenience regarding an eloquent query with laravel, the problem is that when I use the direct select it brings all the normal records without problem, but when using join to bring in this case I bring municipalities and departments only me it brings some (not all) records for example the city (municipality) medellin does not bring it to me when I do the join. I do not know what will be wrong, please help.

$ciudades = DB::table('municipios')
                ->Where('municipio','LIKE',"$request->question%")
                ->get();

This is the result of this query ... it shows me normal, but since I want the department to show me I need to join.

when I do the join

$ciudades =  DB::table('municipios')
              ->join('departamentos','municipios.departamento_id','=','departamentos.id_departamento')
              ->Where('municipio','LIKE',"$request->question%")
              ->get();

If I get to show results but I miss many among those one of the records that I need most and will be consulted a lot.

    
asked by Eric Js Martinez 12.02.2018 в 18:44
source

0 answers