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'));
    }