class Site extends Model
{
public function phrase()
{
return $this->hasOne(Phrase::class, 'site_id', 'id');
}
}
$phrases = [];
foreach ($request->get('phrases') as $phrase) {
$phrases[] = (new Phrase([[
"name" => $phrase["name"],
"counter" => $phrase["counter"],
"site_id" =>$id
]]));
}
$site->phrase()->sync($phrases);