From 7169a25133d8b37d85dcb51ab33b35a9f1efcf25 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Mon, 5 Nov 2018 09:27:17 -0600 Subject: [PATCH] relationships for local key and foreign key in UserRole relationship --- app/Models/UserRole.php | 2 +- database/migrations/2014_10_12_000000_create_users_table.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/UserRole.php b/app/Models/UserRole.php index 01cfeca89..7dce7010f 100644 --- a/app/Models/UserRole.php +++ b/app/Models/UserRole.php @@ -13,6 +13,6 @@ class UserRole extends Model public $timestamps = true; public function user() { - return $this->belongsTo('App\User'); + return $this->belongsTo('App\User', 'character_id', 'user_id'); } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 299d1e2e0..c679ba2e9 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -16,7 +16,7 @@ class CreateUsersTable extends Migration Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); - $table->string('character_id'); + $table->string('character_id')->unique(); $table->string('avatar'); $table->string('access_token')->nullable(); $table->string('refresh_token')->nullable(); @@ -25,7 +25,7 @@ class CreateUsersTable extends Migration $table->string('owner_hash'); $table->string('user_type')->default('Guest'); $table->string('role')->default('Guest'); - $table->text('scopes')->default('publicData'); + $table->text('scopes')->nullable(); $table->string('email')->unique()->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->rememberToken();