App\Libraries\AuthorizationResult::ensureCan PHP Method

ensureCan() public method

public ensureCan ( )
    public function ensureCan()
    {
        if ($this->can()) {
            return;
        }
        if ($this->rawMessage() === 'require_login' || ends_with($this->rawMessage(), '.require_login')) {
            $class = AuthenticationException::class;
        } else {
            $class = AuthorizationException::class;
        }
        throw new $class($this->message());
    }