How to set form input required attribute in laravel 4

前端 未结 4 501
天命终不由人
天命终不由人 2021-01-03 23:05

I\'m using the laravel framework for a project, and I\'m implementing a basic form page, where I require certain values to be required, something that can be do

4条回答
  •  太阳男子
    2021-01-03 23:47

    Check out the API-Docs. The method signature shows that you can provide 3 parameters.

    The first one is the name attribute, the second one is the value attribute. Third one is your array with any additional attributes.

    So just call your method with:

    {{ Form::text('key', 'value', ['required']) }}
    

    And a required attribute will be attached to your input field.

提交回复
热议问题