本文整理汇总了PHP中Zone::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Zone::orderBy方法的具体用法?PHP Zone::orderBy怎么用?PHP Zone::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$zones = Zone::orderBy('id')->get();
$status = array();
foreach ($zones as $zone_count => $zone) {
$count = $zone_count + 1;
$switch_relays = $zone->Relays;
if ($switch_relays->count()) {
foreach ($switch_relays as $relay) {
$status['zone_' . $count . '_status_' . $relay->relay_id] = $relay->status;
}
} else {
for ($i = 0; $i < 6; $i++) {
$status['zone_' . $count . '_status_' . $i] = 'False';
}
}
}
$data = array('page' => 'zones', 'zones' => $zones, 'status' => $status);
return View::make('zones.index', $data);
}
示例2: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$client = Client::where('id', $id)->withTrashed()->with('contacts')->first();
$deptos = explode(',', DEPARTAMENTOS);
$zones = Zone::orderBy('name', 'ASC')->get();
$groups = Group::get();
$businesses = BusinessType::get();
$dias = array();
$fec = str_split($client->frecuency);
foreach ($fec as $d) {
array_push($dias, $d == "1" ? true : false);
}
if ($client) {
if ($client->deleted_at != null) {
$client->restore();
}
$contacts = $client->contacts;
$contactos = array();
foreach ($contacts as $contact) {
# code...
$contactos[] = array('id' => $contact->id, 'nombres' => $contact->first_name, 'apellidos' => $contact->last_name, 'email' => $contact->email, 'phone' => $contact->phone);
//
}
$data = ['client' => $client, 'contactos' => $contactos, 'url' => 'clientes/' . $id, 'title' => 'Editar Cliente', 'zonas' => $zones, 'deptos' => $deptos, 'grupos' => $groups, 'negocios' => $businesses, 'd' => $dias];
$account = Account::find(Auth::user()->account_id);
//data = array_merge($data, self::getViewModel());
$data = array_merge($data, array('cuenta' => $account));
// return Response::json($data);
return View::make('clientes.edit', $data);
}
Session::flash('error', 'No existe el usuario');
return Redirect::to('clientes');
}