lundi 26 mars 2018

how to create collection of array in php?

I need to create a colletion array .I use laravel in this case everything work , the route, the controller etc, the unique problem is that I need to the result have to similar to image

enter image description here

I try this code but dont works

     $contacto_x_agendamientos = Contacto_x_Agendamiento::all();




           $array = array(

 foreach ($contacto_x_agendamientos as $contacto_x_agendamiento) {

     $array_2 = array(

         'id_contacto_agendamiento' =>$contacto_x_agendamiento->id_contacto_x_agendamiento
     );
}
           );




        return response()->json($contacto_x_agendamientos->toArray());

I hope your help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire