You can use the sync method
$stat = Stat::find(1);
$stat->statdatas()->sync([1,3,4]); // enter the ids of the Statdata models
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community