I ran into exactly the same problem and got the perfect solution. This is verified.
$tags = ['#first_Tag','#second_tag','#third_tag','#fourth_Tag']; foreach ($tags as $t) : $model = new Tags; $model->tag_name = $t; $model->save();
This is when you create a new variable with the same name as the existing one, it overwrites its value. Here you do not need to create a new attribute or set id to null ; just unset() $model until the end of the foreach .
source share