Skip to content

Instantly share code, notes, and snippets.

@sineld
Created October 2, 2012 09:12
Show Gist options
  • Save sineld/3817657 to your computer and use it in GitHub Desktop.
Save sineld/3817657 to your computer and use it in GitHub Desktop.
Laravel: Using form::select with <optgroup>
<?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' ));
});
?>
@RicardoCruz6395
Copy link

Worked with Laravel 5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment