53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?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(): void
|
|
{
|
|
Schema::create('users', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('full_name');
|
|
$table->string('username')->unique();
|
|
$table->string('phone_number')->unique();
|
|
$table->string('national_id')->unique();
|
|
$table->string('position');
|
|
$table->string('avatar')->nullable();
|
|
$table->enum('gender', [1 => 'female', 2 => 'male'])->nullable();
|
|
$table->string('password');
|
|
$table->foreignId('province_id')->constrained('provinces');
|
|
$table->string('province_fa');
|
|
$table->string('email')->unique()->nullable();
|
|
$table->dateTime('last_login')->nullable();
|
|
$table->string('telephone_id')->unique()->nullable();
|
|
$table->boolean('is_online')->default(false);
|
|
$table->rememberToken()->nullable();
|
|
$table->timestamps();
|
|
});
|
|
|
|
Schema::create('sessions', function (Blueprint $table) {
|
|
$table->string('id')->primary();
|
|
$table->foreignId('user_id')->nullable()->index();
|
|
$table->string('ip_address', 45)->nullable();
|
|
$table->text('user_agent')->nullable();
|
|
$table->longText('payload');
|
|
$table->integer('last_activity')->index();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('users');
|
|
Schema::dropIfExists('sessions');
|
|
}
|
|
};
|