Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Laravel Form class to add the 'disabled' attribute

Using Laravel 4's Form class, we can create a list using

 {{ @Form::select('colors', Colors::all()), $color }}

Question: How can we add the attribute disabled using Blade without having to rewrite the clean Blade syntax into the usual ugly form?

like image 997
Nyxynyx Avatar asked Jul 19 '13 06:07

Nyxynyx


2 Answers

Just add array('disabled') in the end like:

{{ Form::select('colors', Colors::all(), $color, array('disabled')) }}
like image 191
JustinHo Avatar answered Nov 03 '22 08:11

JustinHo


This should do the work.

 {{ @Form::select('colors', Colors::all()), array(
    'disabled' => 'disabled',
    'class'    => 'myclass'
    ) }}
like image 19
PJunior Avatar answered Nov 03 '22 08:11

PJunior