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


PHP Course::latest方法代码示例

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


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

示例1: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('partials.latestArticles', function ($view) {
         $latestArticles = Article::published()->active()->latest()->take(10)->get();
         $view->with(['latestArticles' => $latestArticles]);
     });
     view()->composer('partials.latestCourses', function ($view) {
         $latestCourses = Course::latest()->take(10)->get();
         $view->with(['latestCourses' => $latestCourses]);
     });
     view()->composer('partials.latestSessions', function ($view) {
         $latestSessions = Session::latest()->take(10)->get();
         $view->with(['latestSessions' => $latestSessions]);
     });
     view()->composer('partials.categories', function ($view) {
         $totalCategories = DB::table('categories')->where('depth', '=', 1)->leftJoin('category_course', 'categories.id', '=', 'category_course.category_id')->leftJoin('article_category', 'categories.id', '=', 'article_category.category_id')->groupBy('categories.id')->select('categories.name', 'categories.id', DB::raw('COUNT(`course_id`) + COUNT(`article_id`) AS num'))->orderBy('num', 'DESC')->get();
         $view->with(['totalCategories' => $totalCategories]);
     });
 }
开发者ID:emadmrz,项目名称:tinker,代码行数:24,代码来源:ViewComposerServiceProvider.php

示例2: index

 public function index()
 {
     $courses = Course::latest('start_date')->published()->get();
     return view('pages.courses')->with('courses', $courses);
 }
开发者ID:Vaaldiii,项目名称:Sonda,代码行数:5,代码来源:CoursesController.php

示例3: main

 public function main()
 {
     $courses = Course::latest('published_at')->Published()->Done()->Paginate(15);
     return view('pages.main', compact('courses'));
 }
开发者ID:DarkBlackJPG,项目名称:Learn_ON-1,代码行数:5,代码来源:CoursesController.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $courses = Course::latest()->get();
     //dd($courses);
     return view('courses.index', compact('courses'));
 }
开发者ID:alexchirea,项目名称:Site-Coupons,代码行数:11,代码来源:CoursesController.php

示例5: index

 public function index()
 {
     $courses = Course::latest()->get();
     return view('course.list', compact('courses'))->with(['title' => 'دوره های آموزشی آنلاین']);
 }
开发者ID:emadmrz,项目名称:tinker,代码行数:5,代码来源:CourseController.php

示例6: composeNavigation

 public function composeNavigation()
 {
     view()->composer('partials.nav', function ($view) {
         $view->with('latest', Course::latest()->first());
     });
 }
开发者ID:veljkodjokic,项目名称:Learn_ON,代码行数:6,代码来源:ViewComposerServiceProvider.php

示例7: index

 public function index()
 {
     $courses = Course::latest()->get();
     $articles = Article::published()->active()->latest()->paginate(10);
     return view('home.index', compact('courses', 'articles'))->with(['title' => $this->config['title'], 'meta_description' => $this->config['description'], 'meta_keywords' => $this->config['keywords']]);
 }
开发者ID:emadmrz,项目名称:tinker,代码行数:6,代码来源:HomeController.php


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