0

I started to use Laravel 10.

I also installed Laravel UI package (composer require laravel/ui --dev) and Bootstrap Auth Scaffolding (php artisan ui bootstrap --auth).

After installing I got several predefined baldes such as register.blade.php, login.blade.php, ... In register.blade.php the form uses this action: action="{{ route('register') }}"

How does predefined routes work in Laravel 10? Where is the 'register' route defined?

I tired to find where 'register' route is defined but couldn't. It is not in the routes/web.php file and I couldn't find it anywhere else.

1
  • Does this link shed any light on your question? laravel.com/docs/10.x/fortify#registration. "Fortify will take care of defining the /register route that returns this view. Your register template should include a form that makes a POST request to the /register endpoint defined by Fortify." If you're using Fortify (or Laravel Breeze), then that should answer it. I don't have much experience with these 2 packages though, so I could be off base here. Commented Sep 1, 2023 at 19:47

3 Answers 3

0

The register route is an authentication route and is defined in routes/auth.php.

in web.php, you see something like this, which loads in the auth routes

require __DIR__.'/auth.php';

You can edit the routes in auth.php to suit your needs.

Sign up to request clarification or add additional context in comments.

2 Comments

Unfortunately, there is no auth.php file in the routes folder.
Assumed you were using Breeze or Jetstream. Look in ui/src/AuthRouteMethods.php Also, I would recommend Breeze over Laravel UI.
0

Laravel does not have any extra route or balde template by default (except welcome blade file which is for route /). Likely you have installed laravel with extra templates like breeze. A good starting kit with authentication system. By this way, you can see and edit defined routes related to authentication (such as register route) in auth.php next to the web.php in routes folder.

1 Comment

Thanks, but unfortunately, there is no auth.php file in the routes folder. And yes, I also installed Laravel UI package (composer require laravel/ui --dev) and Bootstrap Auth Scaffolding (php artisan ui bootstrap --auth).
0

With some help I have found that login, logout, ... routes are defined in UI's AuthRouteMethods.php file. See here: https://github.com/laravel/ui/blob/028e3f8012726693429e3814703705eb639bd184/src/AuthRouteMethods.php#L20

2 Comments

Glad you found it out! In the future, make sure to include additional libraries that you're using to prevent guesses like the other answers here (they are correct, just not for your use-case). Cheers!
I actually commented under mine that this is where he should look lol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.