In terms of the user table, you will always want to run the built in Sentry migrations. However, you can also create a new migration that adds fields to the already existing users table, i.e.
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddFieldsToUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->string('first_name')->after('password');
$table->string('last_name')->after('first_name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table)
{
$table->dropColumn('first_name');
$table->dropColumn('last_name');
});
}
}
```
Regarding extending the Sentry user model, just create your own User model within the models directory and have it extend from the Sentry User model, i.e.
<?php
class User extends \Cartalyst\Sentry\Users\Eloquent\User
{
public function myCustomMethod()
{
//
}
}
~~~
You'll also need to publish Sentry's configuration files, which can then be found in app/config/packages/cartalyst/sentry/config.php. In that file you'll see several keys (i.e. for Group, User, Throttle) that specify the model to use. You'll have to change those to point to the classes you've created.
Hope that helps!
You can also just create a User model and interact with the users table without extending Sentry. Unless you need Senty specific methods there is no need in extending it.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community