M
M
Maqsat Batyrqul2016-01-15 21:08:38
Laravel
Maqsat Batyrqul, 2016-01-15 21:08:38

How to add additional fields to the registration form?

In the LARAVEL registration form, there are standard fields name, email, password, re-password. I would like to add here the addition of an avatar and more additional fields. I didn’t find anything in Authcontroller, then I got AuthenticatesAndRegistersUsers, there is a postRegister method there, but for some reason it does not process additional fields. How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Maqsat Batyrqul, 2016-01-17
@Maqsat

I searched for a long time and finally found the answer, it turns out that AuthController has a protected create method and there you just need to add additional fields and do not forget to add them to the fillable in the model. For a complete understanding see trait RegistersUsers.

G
Gregory, 2016-01-16
@difiso

Well, why shove everything in a heap, why show off something !?
Make a simple registration, and make avatars and any other thing without which it is quite possible to live already inside by editing the user profile.

S
Stanislav Pochepko, 2016-01-15
@DJZT

See Registrar Contract

M
Mikka, 2021-07-28
@Horny_515

Option 1
1. Add the required fields to the register.blade template in the same way as the name field
2. Add the required fields to app/Http/Controllers/Auth/RegisterController.php In the create function
3. Add the required fields to the User.php model required fields
4. Add the necessary fields to the database in the users table
Option 2
There is also an option to create your own separate table and save this data there by calling your function in create and passing user_id to your table (to build a relationship between tables)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question