Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sentry 2 and Laravel 4 adding fields to the user model

Im trying to add fields to the Users model that is based around Sentry 2 for Laravel 4.

I want to do it properly with migrations.

Is there a way to simply add to the sentry 2 migrations? or should i simply make my own migrations and add the required extra fields?

any guidance with the framework would be awesome!

like image 847
AndrewMcLagan Avatar asked Dec 03 '22 23:12

AndrewMcLagan


1 Answers

If you want add some fields you need this:

  • run Sentry Migrations: php artisan migrate --package=cartalyst/sentry
  • create a migration to add custom fields to Users table: php artisan migrate:make --table=users
  • example in funcion up():

Schema::table('users', function(Blueprint $table) { $table->string('new_field'); });

  • And then extend the Sentry User Model:

Check this example is extending Sentry Model and full implementation example check this: Laravel 4 Backend and simple web site

like image 174
Bradley Avatar answered Dec 05 '22 14:12

Bradley