Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thom21's avatar
Level 1

Middleware Laravel 11

Hi everyone! I use Jetstream, Where can I find RedirectIfAuthenticated.php in laravel 11

0 likes
7 replies
Snapey's avatar

Why? What do you hope to do with it?

thom21's avatar
Level 1

I Laravel 10, I use it for redirect a user

MohamedTammam's avatar

It doesn't matter if you're using Jetstream or not.

You need to call RedirectIfAuthenticated::redirectUsing(your_call_back) in AppServiceProvider and then use guest middleware.

Example:

RedirectIfAuthenticated::redirectUsing(function () {
  return route('dashboard');
});

Sources: https://stackoverflow.com/a/78523399

Snapey's avatar

This middleware is only to stop logged in users from accessing login and register routes

Please or to participate in this conversation.