<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class UpdateKategoriMejaSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $kategoriList = ['outdoor', 'vip-outdoor', 'vip-indoor'];
        $mejas = DB::table('meja')->get();

        foreach ($mejas as $index => $meja) {
            DB::table('meja')
                ->where('id', $meja->id)
                ->update([
                    'kategori' => $kategoriList[$index % count($kategoriList)]
                ]);
        }

        echo "Kategori meja berhasil diupdate!\n";
    }
}
