我有多个表数据要在一种控制器方法中获取,并且必须为laravel api返回json。那么我希望将这些表数据用于不同的循环中以进行数据显示。
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