الملفات
Tabeley-v0.0a/database/migrations/2026_02_13_074913_update_users_table.php
2026-02-16 01:57:33 +03:00

30 أسطر
844 B
PHP

<?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) {
// نحذف name الافتراضي
$table->dropColumn('name');
// نضيف الحقول تبع مشروعنا
$table->string('first_name')->after('id');
$table->string('last_name')->after('first_name');
$table->string('phone')->unique()->after('email');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('name');
$table->dropColumn(['first_name', 'last_name', 'phone']);
});
}
};