where('token', $token) ->pending() ->first(); if (! $invitation) { return view('app')->with(['message' => 'Invitation not found or already expired.']); } $invitation->update(['status' => CompanyInvitation::STATUS_DECLINED]); return view('app')->with(['message' => 'Invitation declined.']); } }