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


PHP Course::published方法代码示例

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


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

示例1: getCoursesInCategory

 public function getCoursesInCategory($slug)
 {
     $articles = Article::published()->orderBy('published_at', 'desc')->take(2)->get();
     $category = Category::where('slug', $slug)->first();
     $courses = Course::published()->where('category_id', $category->id)->get();
     return view('courses.index', ['courses' => $courses, 'page_id' => $slug, 'category' => $category, 'latest_articles' => $articles]);
 }
开发者ID:dadigu,项目名称:haskolabru,代码行数:7,代码来源:CoursesController.php

示例2: show

 public function show($slug)
 {
     $page = Page::where('slug', $slug)->first();
     $courses = Course::published()->hasCategory()->orderBy('created_at', 'desc')->take(4)->get();
     $articles = Article::published()->orderBy('published_at', 'desc')->take(2)->get();
     return view('pages.show', ['page' => $page, 'latest_courses' => $courses, 'latest_articles' => $articles]);
 }
开发者ID:dadigu,项目名称:haskolabru,代码行数:7,代码来源:PagesController.php

示例3: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->model('courses', 'App\\Course');
     $router->bind('tags', function ($name) {
         return Tag::where('name', $name)->firstOrFail();
     });
     $router->bind('courses', function ($id) {
         return Course::published()->FindOrFail($id);
     });
 }
开发者ID:veljkodjokic,项目名称:Learn_ON,代码行数:17,代码来源:RouteServiceProvider.php

示例4: show

 public function show(Course $course)
 {
     if (Enroll::where(['course_id' => $course->id, 'user_id' => Auth::user()->id])->ongoing()->exists() and $course->published()) {
         $lecture = $course->lectures()->first();
         $comments = $lecture->comments()->latest('created_at')->get();
         return view('courses.course', compact('course', 'lecture', 'comments'));
     }
     return view('courses.show', compact('course'));
 }
开发者ID:DarkBlackJPG,项目名称:Learn_ON-1,代码行数:9,代码来源:CoursesController.php

示例5: index

 public function index()
 {
     $courses = Course::published()->hasCategory()->orderBy('created_at', 'desc')->take(4)->get();
     $articles = Article::published()->orderBy('published_at', 'desc')->take(2)->get();
     return view('home', ['latest_courses' => $courses, 'latest_articles' => $articles]);
 }
开发者ID:dadigu,项目名称:haskolabru,代码行数:6,代码来源:HomeController.php


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