Last active
August 29, 2015 14:02
-
-
Save burakerdem/41c49b5ee9cc0d7e828e to your computer and use it in GitHub Desktop.
Country Selector for Laravel 4.
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
// Taken from http://chrishayes.ca/blog/code/laravel-4-dry-views-form-html-macros | |
Form::macro('countrySelect', function($name, $selected = 0, $options = []) | |
{ | |
$countries = [0 => 'Select Country'] + Country::remember(60)->get()->lists('name', 'id'); | |
return Form::select($name, $countries, $selected, $options); | |
}); |
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
{{ Form::countrySelect('country') }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment