src/Form.php
public function guard($guard = HoneypotGuard::class, $options = [])
    {
        if ($this->shouldValidate) $this->validate();
        $this->shouldCallGuard = false;
        if ($this->shouldFallThrough) return $this;

        if (is_string($guard) && !class_exists($guard)) {
            throw new Exception("{$guard} does not exist.");
        }

        if (!is_subclass_of($guard, Guard::class)) {
            throw new Exception('Guards must extend '.Guard::class.'.');
        }

        if (is_string($guard)) {
            $guard = new $guard($this, $options);
        }

        $this->perform($guard);

        return $this;
    }
public function guard($guard = HoneypotGuard::class, $options = [])
    {
        if ($this->shouldValidate) $this->validate();
        $this->shouldCallGuard = false;
        if ($this->shouldFallThrough) return $this;

        if (is_string($guard) && !class_exists($guard)) {
            throw new Exception("{$guard} does not exist.");
        }

        if (!is_subclass_of($guard, Guard::class)) {
            throw new Exception('Guards must extend '.Guard::class.'.');
        }

        if (is_string($guard)) {
            $guard = new $guard($this, $options);
        }

        $this->perform($guard);

        return $this;
    }
public function guard ( $ guard = HoneypotGuard :: class , $ options = [ ] ) { if ( $ this -> shouldValidate ) $ this -> validate ( ) ; $ this -> shouldCallGuard = false ; if ( $ this -> shouldFallThrough ) return $ this ; if ( is_string ( $ guard ) && ! class_exists ( $ guard ) ) { throw new Exception ( "{$guard} does not exist." ) ; } if ( ! is_subclass_of ( $ guard , Guard :: class ) ) { throw new Exception ( 'Guards must extend ' . Guard :: class . '.' ) ; } if ( is_string ( $ guard ) ) { $ guard = new $ guard ( $ this , $ options ) ; } $ this -> perform ( $ guard ) ; return $ this ; }
Call a guard

@param  string|Guard $guard   Guard classname or object
@param  array  $options Guard options
Call a guard