diff --git a/src/app/AuthAttempt.php b/src/app/AuthAttempt.php --- a/src/app/AuthAttempt.php +++ b/src/app/AuthAttempt.php @@ -43,6 +43,9 @@ 'last_seen' => 'datetime' ]; + public $incrementing = false; + protected $keyType = 'string'; + /** * Prepare a date for array / JSON serialization. * diff --git a/src/app/Observers/AuthAttemptObserver.php b/src/app/Observers/AuthAttemptObserver.php new file mode 100644 --- /dev/null +++ b/src/app/Observers/AuthAttemptObserver.php @@ -0,0 +1,31 @@ +{$authAttempt->getKeyName()} = $allegedly_unique; + break; + } + } + } +} diff --git a/src/app/Providers/AppServiceProvider.php b/src/app/Providers/AppServiceProvider.php --- a/src/app/Providers/AppServiceProvider.php +++ b/src/app/Providers/AppServiceProvider.php @@ -44,6 +44,7 @@ */ public function boot() { + \App\AuthAttempt::observe(\App\Observers\AuthAttemptObserver::class); \App\Discount::observe(\App\Observers\DiscountObserver::class); \App\Domain::observe(\App\Observers\DomainObserver::class); \App\Entitlement::observe(\App\Observers\EntitlementObserver::class); diff --git a/src/database/migrations/2021_03_25_144555_create_auth_attempts_table.php b/src/database/migrations/2021_03_25_144555_create_auth_attempts_table.php --- a/src/database/migrations/2021_03_25_144555_create_auth_attempts_table.php +++ b/src/database/migrations/2021_03_25_144555_create_auth_attempts_table.php @@ -15,7 +15,7 @@ public function up() { Schema::create('auth_attempts', function (Blueprint $table) { - $table->bigIncrements('id'); + $table->uuid('id')->primary(); $table->bigInteger('user_id'); $table->string('ip', 36); $table->string('status', 36)->default('NEW');