本文整理匯總了PHP中Unit::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Unit::orderBy方法的具體用法?PHP Unit::orderBy怎麽用?PHP Unit::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Unit
的用法示例。
在下文中一共展示了Unit::orderBy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: units
public function units()
{
if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) {
$view = View::make('Settings.Employees.settings_units');
$view->nav = "system";
$view->tab = "units";
$view->units = Unit::orderBy("name")->paginate(50);
return $view;
} else {
return Redirect::to("/");
}
}
示例2: updateEmployee
public function updateEmployee($id)
{
if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) {
$view = View::make('Employees.update_employee');
$employee = Employee::where("employee_number", "=", $id)->first();
if (!$employee) {
return Redirect::to('employees');
}
$view->employee = $employee;
$getManagers = Manager::orderBy('last_name', 'asc')->get();
$managers = array("" => "None");
foreach ($getManagers as $manager) {
if (!empty($manager["first_name"])) {
$managers[$manager["id"]] = $manager["last_name"] . ", " . $manager["first_name"];
} else {
$managers[$manager["id"]] = $manager["last_name"];
}
}
$getBusinessLines = BusinessLine::all();
$businessLines = array("" => "None");
foreach ($getBusinessLines as $businessLine) {
$businessLines[$businessLine["id"]] = $businessLine["name"];
}
$getUnits = Unit::orderBy("name", "asc")->get();
$units = array("" => "None");
foreach ($getUnits as $unit) {
$units[$unit["id"]] = $unit["name"];
}
$view->managers = $managers;
$view->businessLines = $businessLines;
$view->units = $units;
$view->nav = "employees";
return $view;
} else {
return Redirect::to('/');
}
}