feat: user ids to uuids
This commit is contained in:
parent
660014d56d
commit
b71ac00de8
|
|
@ -4,17 +4,31 @@ namespace App\Models;
|
||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use App\Enums\UserRole;
|
use App\Enums\UserRole;
|
||||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||||
use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
|
use HasApiTokens, HasFactory, Notifiable, SoftDeletes, HasUuids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $keyType = 'string';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the IDs are auto-incrementing.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ return new class extends Migration
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->uuid('id')->primary();
|
||||||
$table->string('username');
|
$table->string('username');
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
|
|
@ -29,7 +29,7 @@ return new class extends Migration
|
||||||
|
|
||||||
Schema::create('sessions', function (Blueprint $table) {
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
$table->string('id')->primary();
|
$table->string('id')->primary();
|
||||||
$table->foreignId('user_id')->nullable()->index();
|
$table->foreignUuid('user_id')->nullable()->index();
|
||||||
$table->string('ip_address', 45)->nullable();
|
$table->string('ip_address', 45)->nullable();
|
||||||
$table->text('user_agent')->nullable();
|
$table->text('user_agent')->nullable();
|
||||||
$table->longText('payload');
|
$table->longText('payload');
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ return new class extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->morphs('tokenable');
|
$table->uuidMorphs('tokenable');
|
||||||
$table->text('name');
|
$table->text('name');
|
||||||
$table->string('token', 64)->unique();
|
$table->string('token', 64)->unique();
|
||||||
$table->text('abilities')->nullable();
|
$table->text('abilities')->nullable();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ return new class extends Migration
|
||||||
|
|
||||||
$table->string('image')->nullable();
|
$table->string('image')->nullable();
|
||||||
|
|
||||||
$table->foreignId('creator_id')->nullable()->constrained('users')->nullOnDelete();
|
$table->foreignUuid('creator_id')->nullable()->constrained('users')->nullOnDelete();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ return new class extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('hunt_participants', function (Blueprint $table) {
|
Schema::create('hunt_participants', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
$table->foreignUuid('user_id')->constrained()->cascadeOnDelete();
|
||||||
$table->foreignId('hunt_id')->constrained('hunts')->cascadeOnDelete();
|
$table->foreignId('hunt_id')->constrained('hunts')->cascadeOnDelete();
|
||||||
$table->unsignedSmallInteger('current_step_number')->default(1);
|
$table->unsignedSmallInteger('current_step_number')->default(1);
|
||||||
$table->string('status')->default(ParticipateStatus::Started->value);
|
$table->string('status')->default(ParticipateStatus::Started->value);
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ class BordeauxHuntsSeeder extends Seeder
|
||||||
'title' => 'Place de la Bourse',
|
'title' => 'Place de la Bourse',
|
||||||
'description' => 'Rendez-vous sur cette place emblématique.',
|
'description' => 'Rendez-vous sur cette place emblématique.',
|
||||||
'hint_text' => 'Miroir d\'eau',
|
'hint_text' => 'Miroir d\'eau',
|
||||||
'latitude' => 44.8417,
|
'latitude' => 44.8617,
|
||||||
'longitude' => -0.5706,
|
'longitude' => -0.5606,
|
||||||
'radius_m' => 50,
|
'radius_m' => 50,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ class BordeauxHuntsSeeder extends Seeder
|
||||||
'title' => 'Grand Théâtre',
|
'title' => 'Grand Théâtre',
|
||||||
'description' => 'Un opéra du XVIIIe siècle.',
|
'description' => 'Un opéra du XVIIIe siècle.',
|
||||||
'hint_text' => 'Douze colonnes corinthiennes',
|
'hint_text' => 'Douze colonnes corinthiennes',
|
||||||
'latitude' => 44.8427,
|
'latitude' => 44.8227,
|
||||||
'longitude' => -0.5746,
|
'longitude' => -0.5746,
|
||||||
'radius_m' => 50,
|
'radius_m' => 50,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue