2

In Laravel 4.1, I want to echo:

<label for="name">Name <small>required</small></label>

This doesn't work:

{{ Form::label('name','Name <small>required</small>') }}

are automatically converted to code text…

Is there a way or do I have to skip Form::label and do it manually?

T1000
  • 918
  • 2
  • 15
  • 30
  • You can create a Form::macro. Check [here](http://stackoverflow.com/questions/16613110/laravel-4-how-insert-raw-html-to-label) – tliokos Mar 07 '14 at 19:47
  • 1
    Does this answer your question? [How insert raw HTML to label?](https://stackoverflow.com/questions/16613110/how-insert-raw-html-to-label) – Dharman Sep 27 '21 at 13:21

2 Answers2

2

If you want to use a Html tag inside another by Laravel one you should use HTML::decode.

Correct code :

{{ HTML::decode(Form::label('name','Name <small>required</small>')) }}
Reza Babaei
  • 905
  • 1
  • 14
  • 22
  • 1
    For Laravel 5.1+ users, the correct tag for 'HTML' and 'Form' will be the aliases for Illuminate\Html\HtmlFacade and Illuminate\Html\FormFacade you have configured in your config/app.php – Olantobi Apr 25 '16 at 08:21
0

Try this:

{!! Html::decode(Form::label('name','Name <small>required</small>')) !!}
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • 1
    This code looks (to me) *very* similar to that in the [other answer](https://stackoverflow.com/a/25401545/10871073). You should add some explanatory text, outlining the difference(s) and why your code is better. – Adrian Mole Sep 27 '21 at 12:56