0

I want to add custom user fields, but not have them be assigned at registration or "required". Would the most effective way to do this be adding a field to the Auth object, or would there be a better way to do this?

2
  • You can write a migration to add those fields as nullable terms. And let user fill them later after registration Commented Dec 17, 2015 at 1:51
  • @VishalSh So I would modify the user model in order to include these and set these through queries? Commented Dec 17, 2015 at 2:02

1 Answer 1

1

In a fresh Laravel 5 installation you have to edit the User class and the users migration:

1) In your app/User.php you have to extend the $fillable array for each custom field.

Example: $fillable = ['name', 'email', 'password', 'city']; for a custom city field.

2) In your database/migrations/2014_10_12_000000_create_users_table.php you have to add a database column for each custom field and run afterwards php artisan migrate (see http://laravel.com/docs/master/migrations).

Example: $table->string('city'); for a custom city field.

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

Comments

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.