當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Unit::orderBy方法代碼示例

本文整理匯總了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("/");
     }
 }
開發者ID:johndavedecena,項目名稱:vault,代碼行數:12,代碼來源:SettingsController.php

示例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('/');
     }
 }
開發者ID:johndavedecena,項目名稱:vault,代碼行數:37,代碼來源:EmployeeController.php


注:本文中的Unit::orderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。