Error filling form :: select () from query with stored procedure

0

I have a problem filling out a Form :: select () with my stored procedure, I'd like you to help me what I'm doing wrong:

This is my procedure stored in MySQL:

CREATE PROCEDURE getSucursalCombo()
BEGIN
  SELECT nombre, id FROM sucursales WHERE estado=1;
END;

This procedure I call from my controller in this way

$datos = \DB::select("CALL getSucursalCombo()");

The result I get and can not use in Form :: select () is:

[{"id":"1","nombre":"OFICINA PRINCIPAL"},{"id":"2","nombre":"SUCURSAL II"}]

But if I do this direct query:

$datos = \DB::table('sucursales')->where('estado','=','1')->pluck('nombre','id');

gives me another data structure that SI can be used in Form :: select ()

{"1":"OFICINA PRINCIPAL","2":"SUCURSAL II"}

What should I change in the query to my stored procedure so that I get a simple fix without brackets like the second case?

Thanks for your answers.

    
asked by NCcapa 08.11.2018 в 19:03
source

0 answers