本文整理汇总了PHP中District::select方法的典型用法代码示例。如果您正苦于以下问题:PHP District::select方法的具体用法?PHP District::select怎么用?PHP District::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类District
的用法示例。
在下文中一共展示了District::select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$districts['results'] = District::select('id', 'name as text')->get()->toArray();
foreach ($districts['results'] as $key => $value) {
if ($value['children'] == null) {
unset($districts['results'][$key]);
}
}
$districts['results'] = array_values(array_filter($districts['results']));
return Response::json($districts);
}
示例2: listFilters
public static function listFilters()
{
$filters_data['all'] = array(array('name' => 'Вид', 'list' => Type::select('id', 'name')->get()->toArray()), array('name' => 'Финансиране', 'list' => Financing::select('id', 'name')->get()->toArray()), array('name' => 'Специалности', 'list' => Specialty::select('id', 'name')->get()->toArray()));
if (Input::has('district') == false && Input::has('municipality') == false && Input::has('city') == false) {
$filters_data['all'][] = array('name' => 'Област', 'list' => District::select('id', 'name')->get()->toArray());
}
if (Input::has('district') == true && Input::has('municipality') == false && Input::has('city') == false) {
$district = Input::get('district');
if (is_array(Input::get('district'))) {
$district = end($district);
}
$filters_data['all'][] = array('name' => 'Община', 'previous' => 'Област', 'list' => Municipality::select('id', 'name')->where('district_id', '=', $district)->get()->toArray());
$filters_data['previous_location'] = URL::route('schools.index', Input::except('district', 'municipality', 'city'));
}
if (Input::has('district') == true && Input::has('municipality') == true || Input::has('municipality') == true || Input::has('city') == true) {
$municipality = Input::get('municipality');
if (is_array(Input::get('municipality'))) {
$municipality = end($municipality);
}
$filters_data['all'][] = array('name' => 'Град/село', 'previous' => 'Община', 'list' => City::select('id', 'name')->where('municipality_id', '=', $municipality)->get()->toArray());
$filters_data['previous_location'] = URL::route('schools.index', Input::except('municipality', 'city'));
}
$input_filter = array_filter(Input::only('city', 'district', 'financing', 'municipality', 'specialty', 'type'));
if (!empty($input_filter)) {
$filters_data['clean_all_filters'] = URL::route('schools.index', array_filter(Input::only('search')));
}
return $filters_data;
}