lundi 20 janvier 2020

Pass array into a single column in Laravel

i am trying to pass some values into a single column in laravel database table.

The values are like this 20,45,67,89

but i want them to enter into the colume like this

===USER_ID====
20
45
67
89

I have tried like below, but not working..any suggestions ?

 foreach ($request->val2 as $value){

           $str_explode = explode(",",$value);


           DB::table('retirement')->insertGetId([
                'user_id' => $str_explode,
                'amount'  => $request->val1,
                'week' => $request->week

           ]);


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

Aucun commentaire:

Enregistrer un commentaire