Storage procedures in Laravel does not return more than one table

0

I have a procedure stored in mysql that returns 3 tables, but when invoking it with laravel it only shows me the contents of the first table.

route::get('/prueba/{id}','Emergencia\AsistenciaMedicaController@prueba');
  

 public  function  prueba($id) {
>        dd ($this->EmergenciaProcedure->prueba()) ;
>         //dd($datos);
>        //dd( DB::select('exec prueba '));
>     }
> 
>  public function prueba() {
>         return \DB::select('call prueba');
>     }

I leave the route, the function, the method to call the sp

image 1 is the sp in mysql, the second as the content in the browser is displayed

    
asked by bryan silva 12.06.2018 в 06:40
source

1 answer

0

Try to launch the query with cursors so that eloquent does not parsee the answer

$db = DB::connection()->getPdo();

$sql = "EXEC prueba"; // Aqui poner los que quieras

$cursor = $db->prepare($sql);
$cursor->execute();

while $dato= $cursor->fetch()) {
    echo $dato . "<br>";
}
    
answered by 12.06.2018 в 13:07