<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddSlugToProductsTable extends Migration
{
    public function up()
    {
        // Menambahkan kolom 'slug' ke tabel 'products'
        Schema::table('products', function (Blueprint $table) {
            $table->string('slug')->after('name')->unique();  // Menambahkan kolom slug setelah kolom 'name'
        });
    }

    public function down()
    {
        // Menghapus kolom 'slug' jika migrasi dibatalkan
        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn('slug');
        });
    }
}
