public function ban($ip = null, $type = 'regular')
    {
        $this->validateType($type);

        if (! is_null($ip)) {
            if ('segment' === $type) {
                $ip = Utility::cidr($ip);
            }
        } else {
            $ip = $this->ip();

            session(['isBan' => $type]);
        }

        return $this->model->firstOrCreate(compact('ip'), compact('type'));
    }
public function ban($ip = null, $type = 'regular')
    {
        $this->validateType($type);

        if (! is_null($ip)) {
            if ('segment' === $type) {
                $ip = Utility::cidr($ip);
            }
        } else {
            $ip = $this->ip();

            session(['isBan' => $type]);
        }

        return $this->model->firstOrCreate(compact('ip'), compact('type'));
    }
public function ban ( $ ip = null , $ type = 'regular' ) { $ this -> validateType ( $ type ) ; if ( ! is_null ( $ ip ) ) { if ( 'segment' === $ type ) { $ ip = Utility :: cidr ( $ ip ) ; } } else { $ ip = $ this -> ip ( ) ; session ( [ 'isBan' => $ type ] ) ; } return $ this -> model -> firstOrCreate ( compact ( 'ip' ) , compact ( 'type' ) ) ; }
Ban ip address.

@param string|null $ip
@param string $type

@return Models\Firewall
Ban ip address .