本文整理汇总了PHP中Employee::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::orderBy方法的具体用法?PHP Employee::orderBy怎么用?PHP Employee::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::orderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewAllEmployee
/**
* This function responses to
* the get request of /admin/employee
* and shows all employee as list
*/
public function getViewAllEmployee($msg = null)
{
if (!empty($msg) && $msg == 1) {
return View::make('adminArea.employee.view')->with('employees', Employee::orderBy('id', 'desc')->get())->with('success', 'Employee has been deleted successfully');
}
return View::make('adminArea.employee.view')->with('employees', Employee::orderBy('id', 'desc')->get());
}
示例2: manageEmployees
/**
* Show employee management tabs
*
* @return mixed
*/
public function manageEmployees()
{
$dept = ['' => 'Choose...'] + Department::lists('name', 'id');
$location = ['' => 'Choose...'] + Location::lists('name', 'id');
foreach (Employee::orderBy('lastname', 'ASC')->get() as $emp) {
$fullNames[] = $emp->firstname . ' ' . $emp->lastname;
$empIds[] = $emp->id;
}
$employees = array_combine($empIds, $fullNames);
$employees = ['' => 'Choose...'] + $employees;
return View::make('admin.employees', compact('dept', 'location', 'employees'));
}
示例3: getEmployeesObjectList
public static function getEmployeesObjectList()
{
$employeesList = Employee::orderBy('name', 'asc')->get();
return $employeesList;
}
示例4: advancedSearch
public function advancedSearch()
{
if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin" || Session::get('user_type') == "User")) {
$view = View::make("Employees.advanced_search_employees");
$view->employees = Employee::orderBy("last_name", "asc")->paginate(25);
$view->nav = "employees";
$getManagers = Manager::orderBy('last_name', 'asc')->get();
$managers = array("all" => "All", "" => "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"];
}
}
$view->managers = $managers;
$view->result = Employee::all()->count();
return $view;
} else {
return Redirect::to('/');
}
}