本文整理匯總了PHP中app\Country::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP Country::select方法的具體用法?PHP Country::select怎麽用?PHP Country::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Country
的用法示例。
在下文中一共展示了Country::select方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCountries
/**
* Fetch countries from database
*
* @param bool
*
* @return Illuminate\Database\Eloquent\Collection (of Country)
*/
protected function getCountries($withTrashed)
{
$countries = Country::select('id', 'iso_3166_2', 'name')->orderBy('name');
if ($withTrashed) {
$countries->withTrashed();
}
return $countries->get();
}
示例2: countries
public function countries()
{
return Country::select("id", "name")->lists("name", "id");
}
示例3: getAll
public static function getAll()
{
$countries = Country::select('code', 'name')->get();
return $countries;
}
示例4: getCountry
public static function getCountry()
{
$arr_country = Country::select('name', 'id')->get()->toArray();
return $arr_country;
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$countries = Country::select('id', 'name', 'full_name', 'capital', 'currency', 'currency_symbol')->orderBy('name')->get();
return View('admin.countries', ['countries' => $countries]);
}