Support the ongoing development of Laravel.io →
Authentication Security Database
Last updated 2 years ago.
0

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!
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

@crhayes @zenry Thanks for answers.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.