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. 查詢到下拉菜單的結果
- 3. SharePoint上的CAML查詢下拉菜單
- 4. php-mysql在html下拉菜單中查詢ouptut
- 5. 無法在下拉菜單中選擇元素下拉菜單
- 6. 在Android中下拉菜單
- 7. Knockout.js - 在下拉菜單中
- 8. 下拉菜單在Drupal中?
- 9. 下拉菜單
- 10. 下拉菜單?
- 11. 下拉菜單
- 12. 下拉菜單
- 13. 下拉菜單
- 14. 從下拉菜單中查找元素
- 15. 如何從多個下拉菜單中創建OR mySQL查詢?
- 16. 下拉菜單在...下拉菜單與引導
- 17. 在下拉菜單上有一個下拉菜單?
- 18. Ember視圖下拉菜單下拉菜單中有空標籤
- 19. 從下拉菜單中刪除下拉菜單(選擇)?
- 20. w3css - 下拉菜單中的可靠下拉菜單
- 21. Jquery dropline菜單中的下拉菜單
- 22. pyqt4中子菜單的下拉菜單
- 23. 轉換下拉菜單中的菜單
- 24. 從菜單中選擇下拉菜單
- 25. 如何在Laravel的下拉菜單中加載數據?
- 26. 下拉菜單中的工具提示隱藏在下拉菜單下
- 27. 我在下拉菜單
- 28. 如何在下拉菜單
- 29. 在java下拉菜單?
- 30. 下拉菜單在IE7
「查詢下拉列表」是什麼意思? – phaberest