I dealt with this, and the answer to lukasgeiter is fine, until the strange case where you want to find the id summary string (if you set the column $table->increments('id') to ( Define custom staging table models @ https: / /laravel.com/docs/5.6/eloquent-relationships )
What you can do in this strange case:
$notification = $user->notifications()->having('pivot_id', 2)->first(); echo $notification->pivot->created_at;
You need to include withPivot('id') in your relationship method in the model. i.e.
function notifications() { return $this->belongsToMany('App\Notification')->withPivot('id'); }
source share