app/Repositories/TeamRepository.php
public function getPendingInvitationsForUser($user)
    {
        $invitations = $user->invitations()->with('team.owner')->get();

        foreach ($invitations as $invite) {
            $invite->setVisible(['id', 'team']);

            $invite->team->setVisible(['name', 'owner']);

            $invite->team->owner->setVisible(['name']);
        }

        return $invitations;
    }
public function getPendingInvitationsForUser($user)
    {
        $invitations = $user->invitations()->with('team.owner')->get();

        foreach ($invitations as $invite) {
            $invite->setVisible(['id', 'team']);

            $invite->team->setVisible(['name', 'owner']);

            $invite->team->owner->setVisible(['name']);
        }

        return $invitations;
    }
Get all of the pending invitations for the user.

@param  \Illuminate\Contracts\Auth\Authenticatable  $user
@return \Illuminate\Database\Eloquent\Collection