本文整理匯總了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');
}