Former\Traits\Field::label PHP Method

label() public method

Adds a label to the group/field
public label ( string $text, array $attributes = [] ) : Field
$text string A label
$attributes array The label's attributes
return Field A field
    public function label($text, $attributes = array())
    {
        // Create the Label element
        $for = $this->id ?: $this->name;
        $label = $this->app['former']->label($text, $for, $attributes);
        // Set label
        $this->label = $label;
        if ($this->group) {
            $this->group->setLabel($label);
        }
        return $this;
    }