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

stratboy's avatar

How to make Breeze redirect to home instead of dashboard after registration and login?

Hi! I'm quite new to Laravel and Breeze. Essentially, I don't want the logged in user to be redirected to his dashboard. Instead, I want him to be redirected to home page or, to another custom page based on user 'type'.

So:

  • First, the user see an auth form. Therefore, the home page should show the form.

  • When of if logged in, he will see the home page (instead of dashboard), therefore the home page should show content to a logged in user.

And this was a simplified one. Basically the home page should have some code like 'if the user is logged in, show [content], otherwise show [login form]'.

Now a little more: I should be able to say if user is userA, show only home, otherwise show the home with a menu that has 2 links: home and page_B. page_B should be protected from userA and available only to user different from userA.

Another way to say it:

  • don't need any dashboard
  • I only have 2 pages, including home. Home should be available to any registered user, while the othe page should only be available to specific users.

How to with Breeze? Or should I use some other system?

0 likes
2 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

I made a controller, and put my redirect logic in there, to redirect depending on role.

    public function index() {
        if (!Auth::check()) {
            return redirect('/somewhere');  to where you want to redirect
        }

        $role = Auth::user()->role;
        $checkrole = explode(',', $role);
        if (in_array('admin', $checkrole)) {
            return redirect('/admin/index');
        } else {
            return redirect('/index');
        }
    }

Example of method.

You have to change in RouteServiceProvider:

public const HOME = '/dashboard';

to

public const HOME = '/your_place';
4 likes
stratboy's avatar

But should I move all the Breeze login form to the home page? For now, to have login form when one navigate to the site, I modified my routes like so:

Route::get('/', function () {
    return view('welcome');
})->middleware(['auth'])->name('home');

Though, I don't know if it's the best practice.

Please or to participate in this conversation.