$input['activities'] = array(3,2,5);
foreach($input['activities'] as $activity_id){
$user_activities = new User_activities;
$user_activities->activity_id = $activity_id;
$user_activities->user_id = Auth::id();
$user_activities->save();
}
Is it possible to have a single line of script to do the above save for each statement in Laravel ?
Instead doing the save in foreach, is it possible to do it in a single line?