How to make Laravel (Blade) text field readonly

Marcel picture Marcel · Mar 10, 2015 · Viewed 43.2k times · Source

I have a text box that needs to be made readonly; I don't want to use array('disabled' => 'true') because I need PHP to process the field:

{{ Form::text('login_token', Worker::generateLoginToken()) }}

How do you add this attribute?

Answer

Joseph Silber picture Joseph Silber · Mar 10, 2015

Just add it as the 3rd argument:

{{ Form::text('login_token', Worker::generateLoginToken(), ['readonly']) }}