當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。