public function hasRole($role)
    {
        if (is_string($role)) {
            return $this->roles->contains('slug', $role);
        }

        if (is_array($role)) {
            $roles = $this->getRoleSlugs();

            $intersection      = array_intersect($roles, (array) $role);
            $intersectionCount = count($intersection);

            return ($intersectionCount > 0) ? true : false;
        }

        return ! ! $role->intersect($this->roles)->count();
    }
public function hasRole($role)
    {
        if (is_string($role)) {
            return $this->roles->contains('slug', $role);
        }

        if (is_array($role)) {
            $roles = $this->getRoleSlugs();

            $intersection      = array_intersect($roles, (array) $role);
            $intersectionCount = count($intersection);

            return ($intersectionCount > 0) ? true : false;
        }

        return ! ! $role->intersect($this->roles)->count();
    }
public function hasRole ( $ role ) { if ( is_string ( $ role ) ) { return $ this -> roles -> contains ( 'slug' , $ role ) ; } if ( is_array ( $ role ) ) { $ roles = $ this -> getRoleSlugs ( ) ; $ intersection = array_intersect ( $ roles , ( array ) $ role ) ; $ intersectionCount = count ( $ intersection ) ; return ( $ intersectionCount > 0 ) ? true : false ; } return ! ! $ role -> intersect ( $ this -> roles ) -> count ( ) ; }
Check if user has the given role.

@param string|array $role
@return bool
Check if user has the given role .