TIP 18 / 36

Rename Pivot Table.

If you want to rename "pivot" word and call your relationship something else, you just use ->as('name') in your relationship.

Model:

code
public function podcasts() {
    return $this->belongsToMany(Podcast::class)
        ->as('subscription')
        ->withTimestamps();
}

Controller:

php
$podcasts = $user->podcasts();
foreach ($podcasts as $podcast) {
    // instead of $podcast->pivot->created_at ...
    echo $podcast->subscription->created_at;
}