<?php


use Illuminate\Support\Facades\Auth;

if (!function_exists('hasRole')) {
    function hasRole($typeRole): bool
    {
        $user = Auth::user();

        if (!$user) {
            return false;
        }

        if (is_array($typeRole)) {
            return in_array($user->role->type_role, $typeRole);
        }

        return $user->role->type_role === $typeRole;
    }
}
