<?php

namespace Tests;

use App\Models\Role;
use App\Models\User;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    protected function grantAdminRole(User $user): Role
    {
        $role = Role::firstOrCreate(
            ['name' => 'admin'],
            ['display_name' => 'ادمین', 'guard_name' => 'web']
        );

        $user->roles()->syncWithoutDetaching([$role->id]);

        return $role;
    }
}
