laravel/pulse

Logout Event with laravel/ui causes TypeError

bricehartmann opened this issue · 5 comments

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

What auth driver are you using?

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

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".

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"

@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

Pulse fix coming in #366