I want to move all the data from the post table into the CityPost table, I use foreach but why only one data entry,
 $store = new CityPost;
           $post = Post::all();
           foreach($post as $p){
               $store->user_id = 14; 
               $store->title = $v->title;
               $store->desc = $v->desc;
               $store->save();
           }
           dd($store);
I want all user_id in the PostCity table to be 14
via Chebli Mohamed
 
Aucun commentaire:
Enregistrer un commentaire