本文整理汇总了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;
}
}
示例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');
}
}
示例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', '輸入錯誤,請檢查');
示例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');
}
}