mardi 11 décembre 2018

how to Return multiple array to Response and receive it in separate arrays::json laravel?

i have multiple tables data to fetch in one controller method and have to return in json for laravel api. then i wish to use those table data use in different loop for data display.


    public function getmediSearchmed($med){  

         $results_br = DB::table('table A')->where('medicine', 'like', $med.'%')->get()->toArray(); 
         $results_str = DB::table('table B')->where('medid', 'like', $med.'%')->get()->toArray();       


   return json_encode(array('$first'=>$results_br,'$second'=>$results_str));                  

        }


Now how to receive array FIRST and array SECOND separately to display its data in view page



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GcBfim
via IFTTT

Aucun commentaire:

Enregistrer un commentaire