Laravel Eloquent Relationships

One to Many Tips

While we can save a model directly to the relationships of another using saveMany(), we can also just associate a model with another. This will fill the proper user_id field.

$post->author()->associate($user);