Skip to content
Advertisement

RegistersUsers trait in Laravel 7.2

I want to override core registration functionality in Laravel 7.23.2. According to this source I need to override the register() function, which belongs to the trait ‘RegistersUsers’ and is located in vendor/laravel/framework/src/Illuminate/Foundation/Auth/

However, in this folder all I see is User.php and “Access” folder which does not have the aforementioned trait as well. I’ve searched the entire vendor folder and there is no file RegistersUsers.php. In GitHub of Laravel Framework 7.x, there is no such file as well.

But I can see one in Laravel 5.5. So I assume registration method resides somewhere else.

So basically my two questions:

  1. In registration controller there is a line use RegistersUsers;
    If there is no RegistersUsers.php, then what is being used here?

  2. This will probably be answered by the first one, but where I can find the core implementation of register() method?

Advertisement

Answer

This was moved out of the core and is part of the laravel/ui package. So the file would be in vendor/laravel/ui/auth-backend/.

You can open that and see the register method, but you may not have to override it. That method calls other methods that you can override as well. Some of these methods are only there basically so you can override them so you don’t have to override the entire Registration system.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement