TIP 17 / 36

Instead of Belongsto, Use Hasmany.

For belongsTo relationship, instead of passing parent's ID when creating child record, use hasMany relationship to make a shorter sentence.

code
// Given that Post belongs to User and User has many posts:
// Instead of assigning user_id manually:
Post::create([
    'user_id' => auth()->id(),
    'title' => request()->input('title'),
    'post_text' => request()->input('post_text'),
]);

// Recommended approach:
auth()->user()->posts()->create([
    'title' => request()->input('title'),
    'post_text' => request()->input('post_text'),
]);