Skip to content

Commit

Permalink
add user token for device
Browse files Browse the repository at this point in the history
  • Loading branch information
omar95-pero committed Nov 28, 2023
1 parent a3a1b86 commit f46cf95
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@ public function up(): void
$table->morphs('user');
$table->string('signature');
$table->foreignId('agent_id');
$table->unique(['user_id', 'user_type', 'signature', 'agent_id']);
$table->unsignedBigInteger('auth_token_id')->nullable();
$table->foreignId('token_id')->nullable();
$table->unique(['user_id', 'user_type', 'signature', 'agent_id', 'token_id']);

$table->string('ip');
$table->string('fcm_token')->nullable();
$table->string('fcm')->nullable();
$table->json('data')->nullable();
$table->boolean('is_primary')->default(false);
$table->boolean('logged_out')->default(true);
$table->boolean('is_primary')->default(false)->index();
$table->boolean('logged_out')->default(false);
$table->timestamp('last_action_at');
$table->timestamps();

// Relationships
$table->foreign('agent_id')->references('id')->on('agents')->onDelete('cascade');
$table->foreign('auth_token_id')->references('id')->on('personal_access_tokens')->onDelete('set null');

if (Schema::hasTable('personal_access_tokens')) {
$table->foreign('token_id')->references('id')->on('personal_access_tokens')->onDelete('set null');
}
});
}

Expand All @@ -41,4 +43,5 @@ public function down(): void
{
Schema::dropIfExists('user_devices');
}
};
}
;

0 comments on commit f46cf95

Please sign in to comment.