mercredi 22 mai 2019

How to get data array according to key?

I am getting Images array according to user id and i have image types like profile, cnic etc. How i can set image type according to key like in profile key profile image should come. I dont have idea how to do this. I have posted picture of table where i have images with image type.

table

  $getImages = Image::where('user_id',$getPartnerData[0]->id)
                ->where('user_type','partner')->get();


            foreach($getImages as $img) {
                $images = array(
                    "profile" =>  $img->image,
                    "doc" =>  $img->image,
                    "cnic back" =>  $img->image,
                    "cnic front" =>  $img->image,
                );
            }

            $dataRegister = array(
                "name" => $getPartnerData[0]->pNAME,
                "email" > $getPartnerData[0]->email,
                "phone_number" > $getPartnerData[0]->phone_number,

                "images" => $images,
        );



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire