dimanche 8 décembre 2019

how to make an eloquent result into an array Laravel

I want to combine two data search results into one array, I use array_merge but there is an array_merge () error: Argument # 1 is not an array, how to turn $ vendor's eloquent results into an array and combine it with $ plucked ?

 $vendor = Vendor::find($id);
        $vendor_detail = VendorDetail::where('vendor_id',$id)->get();
        $plucked = $vendor_detail->pluck('vendor_profile_value','vendor_profile_name');

        $coba = array_merge($vendor,$plucked);

$plucked already an array i think the problem here is that $vendor is not yet an array,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire