0
A
回答
0
0
{!! Form::select('userCountry', \App\Libraries\Countries::countryList('alpha3', 'country_name') , 'USA' , ['class' => 'form-control']) !!}
这里的足够的国家类的你要弄清楚它是如何工作:
/**
* Builds a key/value pair
* @param $key
* @param $value
* @return array|bool
*/
public static function countryList($key, $value)
{
$json = self::countryData();
$data = json_decode(self::countryData());
if(!$data && !is_array($data)) {
return false;
}
$out = [];
foreach($data as $country) {
if(property_exists($country, $key) && property_exists($country, $value)) {
$out[$country->{$key}] = $country->{$value};
}
}
return $out;
}
public static function countryData()
{
return str_replace(' ', '', str_replace("\n", '', '
[
{
"alpha2": "AF",
"alpha3": "AFG",
"country_code": "93",
"country_name": "Afghanistan",
"mobile_begin_with": [
"7"
],
"phone_number_lengths": [
9
]
},
{
"alpha2": "AL",
"alpha3": "ALB",
"country_code": "355",
"country_name": "Albania",
"mobile_begin_with": [
"6"
],
"phone_number_lengths": [
8
]
},
{
"alpha2": "DZ",
"alpha3": "DZA",
"country_code": "213",
"country_name": "Algeria",
"mobile_begin_with": [
"5",
"6",
"7"
],
"phone_number_lengths": [
9
]
},
0
这里的我使用CustomerModel作为客户详细信息的模型,我正在获取客户名称作为下拉列表:
$cust_details=CustomerModel::where('active_status',0)->get();
return view('FrontPage.itemadd')->with('cust_details',$cust_details);
in FrontPage.itemadd.blade我使用下面的代码将客户名称放在下拉列表中。
<select id="cab_types" class="form-control" name="customer_name" id="customer_name" required>
<option value="">Select</option>
@foreach($cust_details as $cust)
<option value="{{$cust->id}}">{{$cust->customer_name}}</option>
@endforeach
</select>
相关问题
- 1. 下拉菜单CSS查询
- 2. CodeIgniter从查询中下拉菜单
- 3. 查询到下拉菜单的结果
- 4. 下拉菜单查询数据库
- 5. Android UI查询 - 下拉滑块菜单
- 6. SharePoint上的CAML查询下拉菜单
- 7. php-mysql在html下拉菜单中查询ouptut
- 8. 在PHP中使用查询结果填充下拉菜单
- 9. 在下拉菜单中更改CSS下拉菜单
- 10. 在下拉菜单中转换CSS下拉菜单
- 11. 无法在下拉菜单中选择元素下拉菜单
- 12. 在jquery下拉菜单中
- 13. contactform在下拉菜单中
- 14. 在android中下拉菜单
- 15. 下拉菜单在Drupal中?
- 16. Knockout.js - 在下拉菜单中
- 17. 在Android中下拉菜单
- 18. 从下拉菜单中选择下拉菜单中的数值
- 19. 下拉菜单
- 20. 下拉菜单?
- 21. 下拉菜单
- 22. 下拉菜单
- 23. 下拉菜单
- 24. 下拉菜单
- 25. 下拉菜单
- 26. 下拉菜单
- 27. 下拉菜单
- 28. 下拉菜单
- 29. 从下拉菜单中查找元素
- 30. 如何从多个下拉菜单中创建OR mySQL查询?
“查询下拉列表”是什么意思? – phaberest