user(); if(!$user) return false; $roles = explode(',', $roles); $effectiveRoles = Role::effectiveRoles($user->role); return count(array_intersect($roles, $effectiveRoles)) > 0; } } if(!function_exists('roleName')) { function roleName($role): string { return Role::NAMES[$role]; } } // return current year if(!function_exists('year')) { function year(): int { return (int)session('year', date('Y')); } } if(!function_exists('glob_safe')) { function glob_safe(string $str): string { return str_replace(['[', ']', '*', '?'], ['[[]', '[]]', '[*]', '[?]'], $str); } } if(!function_exists('fileName')) { function fileName($file): string { return preg_replace('/[\\*\\:\\\\\\/\\?<>]/', '_', $file); } }