Created
October 2, 2012 09:12
-
-
Save sineld/3817657 to your computer and use it in GitHub Desktop.
Laravel: Using form::select with <optgroup>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Source: http://forums.laravel.com/viewtopic.php?id=2807 | |
Route::get('optgroup', function() | |
{ | |
$eat_options = array( | |
'animals' => array( | |
'cats', | |
'dogs', | |
'monkeys', | |
), | |
'robots' => array( | |
'bender', | |
'johnny 5', | |
'metal gear', | |
), | |
); | |
echo Form::select( 'thing_to_eat', $eat_options, Input::old( 'thing_to_eat' )); | |
}); | |
?> |
Perfect 💯 works with laravel 5.3*
Worked with Laravel 5.4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it works with laravel 5.3, i had the same issue but i used [ ] instead of array()