Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout Event with laravel/ui causes TypeError #324

Closed
bricehartmann opened this issue Mar 3, 2024 · 5 comments
Closed

Logout Event with laravel/ui causes TypeError #324

bricehartmann opened this issue Mar 3, 2024 · 5 comments

Comments

@bricehartmann
Copy link

Pulse Version

1.0.0-beta11

Laravel Version

10.43.0

PHP Version

8.3

Livewire Version

3.4.4

Database Driver & Version

MySQL 8

Description

I'm using laravel/ui and when a user logs out of my application, the Logout event has null for the $user, causing a type error in Laravel Pulse:

Laravel\Pulse\Pulse::rememberUser(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, null given, called in /home/forge/example.com/vendor/laravel/pulse/src/PulseServiceProvider.php on line 124

https://github.com/laravel/pulse/blob/1.x/src/PulseServiceProvider.php#L124

Steps To Reproduce

  1. Install laravel/ui
  2. Install laravel/pulse
  3. Configure exception handling for Pulse
  4. Log in to the application
  5. Log out of the application
@timacdonald
Copy link
Member

What auth driver are you using?

Are you able to see what the value of the $guard property is on the Logout event?

@bricehartmann
Copy link
Author

I am using the session web driver and the eloquent users driver. The configured user model is at \App\User, not \App\Models\User.

The value of the $guard property on the Logout event is "web".

@timacdonald
Copy link
Member

Hi, @bricehartmann, I'm unable to replicate this issue with a fresh installation of Laravel Pulse and Laravel UI.

I'll close this issue, but if you are able to create a minimal reproduction for this we can reopen the issue and take a closer look.

laravel new bug-report --github="--public"

@timacdonald
Copy link
Member

timacdonald commented May 8, 2024

@bricehartmann, thanks to #364 I was able to get to the bottom of this one.

Can you please make sure your logout route requires authentication by adding:

$this->middleware('auth')->only('logout');

to your LoginController constructor.

Please see https://github.com/laravel/ui/pull/269/files

@timacdonald
Copy link
Member

Pulse fix coming in #366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants