skip to Main Content

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.

3

Answers


  1. Chosen as BEST ANSWER

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

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search