<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        $this->call([
            RolePermissionSeeder::class,
            CategorySeeder::class,
            TemplateSeeder::class,
        ]);

        // Ensure Passport Personal Access Client exists after seeding
        if (!\Laravel\Passport\Client::where('personal_access_client', 1)->exists()) {
            \Illuminate\Support\Facades\Artisan::call('passport:client', [
                '--personal' => true,
                '--no-interaction' => true
            ]);
        }
    }
}
