当前位置: 首页>>代码示例>>PHP>>正文


PHP Course::orderBy方法代码示例

本文整理汇总了PHP中app\Course::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::orderBy方法的具体用法?PHP Course::orderBy怎么用?PHP Course::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Course的用法示例。


在下文中一共展示了Course::orderBy方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: all

 public function all()
 {
     $breadcrumbs = array(action('HomeController@show') => 'Início', action('CourseController@all') => 'Todos os cursos');
     $previous = action('HomeController@show');
     $courses = Course::orderBy('name')->get();
     return view('all-courses', compact('breadcrumbs', 'previous', 'courses'));
 }
开发者ID:joaopluis,项目名称:oldschool,代码行数:7,代码来源:CourseController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $teacher = User::find(Auth::user()->id);
     $resourceTypes = Resource_type::all();
     $courses = $crs = Course::orderBy('affiliateId', 'DESC')->orderBy('streamId', 'DESC')->orderBy('levelId', 'DESC')->get();
     return view('teacher')->with('teacher', $teacher)->with('resourceTypes', $resourceTypes)->with('courses', $courses);
 }
开发者ID:premsingh4github,项目名称:SchoolUmbrella,代码行数:12,代码来源:TeacherController.php

示例3: courses

 public function courses()
 {
     $courses = Course::orderBy('created_at', 'desc')->get();
     $return_data = [];
     foreach ($courses as $course) {
         $return_data[] = ["id" => $course->id, "linkId" => convert_vi_to_en($course->name), 'name' => "Khoá học " . $course->name, "icon_url" => $course->icon_url, "description" => $course->description, "avatar_url" => $course->image_url, "price" => currency_vnd_format($course->price)];
     }
     return $this->respond($return_data);
 }
开发者ID:Kaelcao,项目名称:colormev2,代码行数:9,代码来源:CoursePublicApiController.php

示例4: index

 public function index(Request $request)
 {
     // 获取排序条件
     $orderColumn = $request->get('sort_up', $request->get('sort_down', 'created_at'));
     $direction = $request->get('sort_up') ? 'asc' : 'desc';
     $courses = Course::orderBy($orderColumn, $direction)->paginate(8);
     $stores = json_encode(DB::table('stores')->where('deleted_at', null)->select('id', 'name')->get());
     $coaches = json_encode(DB::table('coaches')->where('deleted_at', null)->select('id', 'name')->get());
     return view('admin.course.list', compact('courses', 'stores', 'classrooms', 'coaches', 'query'));
 }
开发者ID:Kangaroos,项目名称:restart-reserve,代码行数:10,代码来源:CourseController.php

示例5: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $student = Auth::user();
     $regs = Registration::where('student_id', '=', $student->id)->get();
     if (count($regs) > 0) {
         Flash::error('You have completed registration!.');
         return redirect()->route('registration.index');
     }
     $courses = Course::orderBy('name')->lists('name', 'id');
     return view('reg.create', compact('courses'));
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:16,代码来源:RegistrationController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $courses = Course::orderBy('name')->get();
     foreach ($courses as $course) {
         $user = User::where('id', '=', $course->lecturer_id)->firstOrFail();
         $course['lecturer_name'] = $user->name;
         $dept = Department::where('id', '=', $course->department_id)->firstOrFail();
         $course['department_name'] = $dept->name;
     }
     return view('course.index', compact('courses'));
 }
开发者ID:omoprodigi,项目名称:Keyword-Matching-Exam,代码行数:16,代码来源:CourseController.php

示例7: index

 public function index(Request $request)
 {
     $courses = [];
     try {
         $title = $request->all()['title'];
         $subject = $request->all()['subject'];
         $number = $request->all()['number'];
         $courses = Course::where('title', 'like', '%' . $title . '%')->where('subject_code', 'like', '%' . $subject . '%')->where('number', 'like', '%' . $number . '%')->orderBy('subject_code')->orderBy('number')->paginate(10);
     } catch (\ErrorException $e) {
         $courses = Course::orderBy('subject_code')->orderBy('number')->paginate(25);
     }
     return view('courses.index')->with('courses', $courses);
 }
开发者ID:AUCSC,项目名称:sac,代码行数:13,代码来源:CoursesController.php

示例8: listAllCourses

 public function listAllCourses()
 {
     return Course::orderBy('name', 'asc')->lists('name', 'id');
 }
开发者ID:robeasdon,项目名称:golf-stat-tracker,代码行数:4,代码来源:CourseRepository.php

示例9: index

 public function index()
 {
     $courses = Course::orderBy('importance', 'desc')->get();
     return view('resume.courses', compact('courses'));
 }
开发者ID:arbuthnott,项目名称:Portfolio,代码行数:5,代码来源:CourseController.php

示例10: index

 /**
  * Display the landing page of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $newCourses = Course::orderBy('created_at', 'desc')->take(2)->get();
     $poularCourses = DB::table('courses')->leftjoin('user_course', 'courses.id', '=', 'user_course.course_id')->join('users', 'user_course.user_id', '=', 'users.id')->groupBy('courses.id')->take(2)->get();
     return view('public.home')->with('newCourses', $newCourses)->with('popularCourses', $poularCourses);
 }
开发者ID:salvomulas,项目名称:angryproton,代码行数:11,代码来源:PublicController.php

示例11: courses

 public function courses()
 {
     $courses = Course::orderBy('created_at', 'desc')->get();
     return response()->json(['courses' => $courses]);
 }
开发者ID:Kaelcao,项目名称:colormev2,代码行数:5,代码来源:MobileController.php

示例12: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit()
 {
     $organization = Organization::where('userId', Auth::user()->id)->first();
     $crs = Course::orderBy('affiliateId', 'DESC')->orderBy('streamId', 'DESC')->orderBy('levelId', 'DESC')->get();
     return view('organization.edit')->with('organization', $organization)->with('courses', $crs);
 }
开发者ID:premsingh4github,项目名称:SchoolUmbrella,代码行数:12,代码来源:OrganizationController.php

示例13: adminIndex

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function adminIndex()
 {
     $courses = Course::orderBy('day')->with(['manager', 'instrument', 'article', 'documents', 'users' => function ($query) {
         $query->where('level', 0)->where('validated', 1)->orderBy('last_name');
     }, 'teachers' => function ($query) {
         $query->where('level', 1)->where('validated', 1)->orderBy('last_name');
     }])->paginate(20);
     return view('admin.courses.index', compact('courses'));
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:14,代码来源:CourseController.php

示例14: function

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    /**
     * List all courses
     */
    Route::get('/', function () {
        $courses = Course::orderBy('created_at', 'asc')->get();
        return view('courses', ['courses' => $courses]);
    });
    /**
     * Add a course
     */
    Route::post('/course', function (Request $request) {
        $validator = Validator::make($request->all(), ['name' => 'required|max:255', 'date' => 'required']);
        if ($validator->fails()) {
            return redirect('/')->withInput()->withErrors($validator);
        }
        $course = new Course();
        $course->name = $request->name;
        $course->date = $request->date;
        $course->save();
        return redirect('/');
开发者ID:nielvrom,项目名称:StudyxLaravelWebinar,代码行数:31,代码来源:routes.php


注:本文中的app\Course::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。