User registration
routes/auth.php
file, which is loaded inside routes/api.php
.app/Http/Controllers/Auth/RegisteredUserController.php
.
The store
method is the primary method in this controller. It handles incoming registration requests. The method accepts a RegisterRequest
object, which encapsulates the validation rules for the registration data.
Here’s a brief overview of the store
method:
store
method performs the following steps:
User
instance using the validated data from the RegisterRequest
object. The password is hashed before being stored in the database.
Registered
event, passing the newly created user as the event’s argument. This event can be used to perform actions after a user has been registered, such as sending a welcome email.
return response()->token($user);
method, refer to the Response Macros section.