<?php

use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        $role = Role::create(['name' => 'admin']);
        $permission = Permission::create(['name' => 'reconcile_missing_liveries']);

        $role->givePermissionTo($permission);

        $user = User::whereName('Josh')->first();

        $user->assignRole($role);
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {

    }
};
