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


PHP Teacher::orderBy方法代碼示例

本文整理匯總了PHP中Teacher::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Teacher::orderBy方法的具體用法?PHP Teacher::orderBy怎麽用?PHP Teacher::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Teacher的用法示例。


在下文中一共展示了Teacher::orderBy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTeacherSelectArray

 public static function getTeacherSelectArray()
 {
     if (self::$teacherSelectArrayCache == null) {
         $teacherSelectArray[0] = '無';
         $teacher = Teacher::orderBy('teacher_name')->with('classes')->get();
         foreach ($teacher as $teacherItem) {
             $string = $teacherItem->teacher_name;
             if ($teacherItem->classes != null) {
                 $string .= '(' . $teacherItem->classes->classes_name . ')';
             }
             $teacherSelectArray[$teacherItem->teacher_id] = $string;
         }
         self::$teacherSelectArrayCache = $teacherSelectArray;
         return $teacherSelectArray;
     } else {
         return self::$teacherSelectArrayCache;
     }
 }
開發者ID:ramazanalic,項目名稱:open-school-timetable,代碼行數:18,代碼來源:Teacher.php

示例2: list_teachers

 public function list_teachers()
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         $data["actions"] = Session::get('actions');
         if (in_array('side_listar_profesores', $data["actions"])) {
             $data["search"] = null;
             $data["teachers_data"] = Teacher::orderBy('lastname')->paginate(20);
             return View::make('people/list_teachers', $data);
         } else {
             // Llamo a la función para registrar el log de auditoria
             $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
             Helpers::registerLog(10, $log_description);
             Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
             return Redirect::to('/dashboard');
         }
     } else {
         return View::make('error/error');
     }
 }
開發者ID:damv93,項目名稱:trecedemayolaravel,代碼行數:21,代碼來源:PeopleController.php

示例3: function

     return View::make('timetable')->with($viewData);
 });
 // 顯示教師排課清單
 Route::get('view_title/{titleId}/{teacherId}', function ($titleId, $teacherId) {
     $teacherList = $titleId == 'all' ? Teacher::orderBy('teacher_name') : Teacher::where('title_id', '=', $titleId)->orderBy('teacher_name');
     $viewData['teacherList'] = $teacherList->get();
     $viewData['titleList'] = Title::orderBy('title_name')->get();
     $viewData['titleId'] = $titleId;
     $viewData['teacher'] = Teacher::find($teacherId);
     $viewData['teacherId'] = $teacherId;
     $viewData['courseUnits'] = $viewData['teacher']->courseunit;
     return View::make('timetable')->with($viewData);
 });
 // 顯示教師排課編輯畫麵
 Route::get('view_title/{titleId}/{teacherId}/{courseUnitId}', function ($titleId, $teacherId, $courseUnitId) {
     $teacherList = $titleId == 'all' ? Teacher::orderBy('teacher_name') : Teacher::where('title_id', '=', $titleId)->orderBy('teacher_name');
     $viewData['teacherList'] = $teacherList->get();
     $viewData['titleList'] = Title::orderBy('title_name')->get();
     $viewData['titleId'] = $titleId;
     $viewData['teacher'] = Teacher::find($teacherId);
     $viewData['teacherId'] = $teacherId;
     $viewData['courseUnits'] = $viewData['teacher']->courseunit;
     $viewData['courseUnit'] = Courseunit::find($courseUnitId);
     return View::make('timetable')->with($viewData);
 });
 // 執行更新排課設定
 Route::post('edit/{titleId}/{teacherId}/{courseUnitId}', function ($titleId, $teacherId, $courseUnitId) {
     // 設定為編輯模式,方便驗證功能
     $validator = FormValidator::courseUnit(array_merge(Input::all(), array('mode' => 'edit' . $courseUnitId)));
     if ($validator->fails()) {
         return Redirect::to('/timetable/view_title/' . $titleId . '/' . $teacherId . '/' . $courseUnitId)->withInput()->withErrors($validator)->with('message', '輸入錯誤,請檢查');
開發者ID:ramazanalic,項目名稱:open-school-timetable,代碼行數:31,代碼來源:routes.php

示例4: edit_course

 public function edit_course($id = null)
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         $data["actions"] = Session::get('actions');
         if (in_array('side_nuevo_curso', $data["actions"]) && $id) {
             $data["course_info"] = Course::find($id);
             if (!$data["course_info"]) {
                 Session::flash('error', 'No se encontró el Curso solicitado.');
                 return Redirect::to('levels/list_levels');
             }
             $teachers = Teacher::orderBy('lastname')->get();
             $data["teachers"] = $teachers->lists('FullName', 'id');
             return View::make('levels/edit_course', $data);
         } else {
             // Llamo a la función para registrar el log de auditoria
             $log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
             Helpers::registerLog(10, $log_description);
             Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
             return Redirect::to('/dashboard');
         }
     } else {
         return View::make('error/error');
     }
 }
開發者ID:damv93,項目名稱:trecedemayolaravel,代碼行數:26,代碼來源:LevelController.php


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