lundi 9 décembre 2019

how to make data updates in the EAV database

I have a problem here I am trying to make a data update, while in the database using EAV Entity – attribute – value storage type, here I am trying to use foreach and update, but what happens is the data changes based on the last data, is there any wrong code or is there a solution for updating EAV data

 $array = array(
            'name'       => $request->name,
            'address'    => $request->address,
            'max_rapot'  => $request->max_rapot,
        );
        foreach($array as $key => $value)
        {
            DB::table('thisIsSchema.user_detail')->where('user_id',$request->user_id)->update([
                'user_profile_name' => $key,
                'user_profile_value' => $value
            ]);
        }


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire