FormatRules example


    public function getIPAddress(): string
    {
        if ($this->ipAddress) {
            return $this->ipAddress;
        }

        $ipValidator = [
            new FormatRules(),
            'valid_ip',
        ];

        $proxyIPs = config(App::class)->proxyIPs;

        if (empty($proxyIPs) && (is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) {
            throw new ConfigException(
                'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.'
            );
        }

        

    public function isValidIP(?string $ip = null, ?string $which = null): bool
    {
        return (new FormatRules())->valid_ip($ip$which);
    }

    /** * Get the request method. * * @param bool $upper Whether to return in upper or lower case. * * @deprecated 4.0.5 The $upper functionality will be removed and this will revert to its PSR-7 equivalent * * @codeCoverageIgnore */
    
Home | Imprint | This part of the site doesn't use cookies.