You don't really need to think about Sentry in this case, Setry's tables are common tables like any other one, so you can just:
php artisan migrate:make create_user_activity_table
And create your table relating to users:
<?php
use Illuminate\Database\Migrations\Migration;
class CreateUserActivityTable extends Migration {
public function up()
{
Schema::create('user_activity', function($table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->string('<column_name>');
$table->timestamps();
});
Schema::table('user_activity', function($table) {
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
public function down()
{
Schema::drop('user_activity');
}
}
EDIT
To use and create your relations, it you can publish Sentry's config:
php artisan config:publish cartalyst/sentry
Edit app/config/packages/cartalyst/sentry/config.php
and change
'model' => 'Cartalyst\Sentry\Users\Eloquent\User',
To your own model (which may be at app/models/User.php
):
'model' => 'User',
But your model will have to now extend Sentry's original:
class User extends Cartalyst\Sentry\Users\Eloquent\User {
public function activities()
{
return $this->hasMany('UserActivity');
}
}
And create a model for your new table:
class UserActivity extends \Eloquent {
protected $table = 'user_activity';
public function user()
{
return $this->belongsTo('User');
}
}
And now you can:
$user = User::findById(1);
foreach($user->activities as $activity)
{
echo $activity->description;
echo $activity->user->name;
}