feat: login v2

This commit is contained in:
2025-09-10 17:26:32 +03:30
parent a2e49f985e
commit d9d7c078bb
6 changed files with 187 additions and 5 deletions
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('identifier')->nullable()->unique();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};
@@ -0,0 +1,78 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'first_name')) {
$table->dropColumn('first_name');
}
if (Schema::hasColumn('users', 'last_name')) {
$table->dropColumn('last_name');
}
if (Schema::hasColumn('users', 'avatar')) {
$table->dropColumn('avatar');
}
if (Schema::hasColumn('users', 'uuid')) {
$table->dropColumn('uuid');
}
if (Schema::hasColumn('users', 'is_admin')) {
$table->dropColumn('is_admin');
}
if (Schema::hasColumn('users', 'wallet')) {
$table->dropColumn('wallet');
}
});
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'name')) {
$table->string('name')->nullable()->after('id');
}
if (!Schema::hasColumn('users', 'identifier')) {
$table->string('identifier')->unique()->after('mobile');
}
if (!Schema::hasColumn('users', 'remember_token')) {
$table->rememberToken();
}
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'name')) {
$table->dropColumn('name');
}
if (Schema::hasColumn('users', 'identifier')) {
$table->dropColumn('identifier');
}
if (Schema::hasColumn('users', 'remember_token')) {
$table->dropColumn('remember_token');
}
if (!Schema::hasColumn('users', 'first_name')) {
$table->string('first_name')->nullable();
}
if (!Schema::hasColumn('users', 'last_name')) {
$table->string('last_name')->nullable();
}
if (!Schema::hasColumn('users', 'avatar')) {
$table->string('avatar')->nullable();
}
if (!Schema::hasColumn('users', 'uuid')) {
$table->uuid('uuid')->unique();
}
if (!Schema::hasColumn('users', 'is_admin')) {
$table->boolean('is_admin')->default(false);
}
if (!Schema::hasColumn('users', 'wallet')) {
$table->unsignedBigInteger('wallet')->default(0);
}
});
}
};