LaravelBook\Laravel4Powerpack\Form::open PHP Method

open() public method

Open a "POST" form to the current request URI echo Form::open(); Open a "POST" form to a given URI echo Form::open('user/profile'); Open a "PUT" form to a given URI echo Form::open('user/profile', 'put'); Open a form that has HTML attributes echo Form::open('user/profile', 'post', array('class' => 'profile'));
public open ( string $action = null, string $method = 'POST', array $attributes = [], boolean $https = null ) : string
$action string
$method string
$attributes array
$https boolean
return string
    public function open($action = null, $method = 'POST', $attributes = array(), $https = null)
    {
        $method = strtoupper($method);
        $attributes['method'] = $this->method($method);
        $attributes['action'] = $this->action($action, $https);
        // If a character encoding has not been specified in the attributes, we will
        // use the default encoding as specified in the variable $encoding above
        // for the "accept-charset" attribute.
        if (!array_key_exists('accept-charset', $attributes)) {
            $attributes['accept-charset'] = $this->encoding;
        }
        $append = '';
        // Since PUT and DELETE methods are not actually supported by HTML forms,
        // we'll create a hidden input element that contains the request method
        // and set the actual request method variable to POST.
        if ($method == 'PUT' or $method == 'DELETE') {
            $append = $this->hidden($this->spoofer, $method);
        }
        return '<form' . $this->html->attributes($attributes) . '>' . $append;
    }