本文整理汇总了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]);
});
}
示例2: index
public function index()
{
$courses = Course::latest('start_date')->published()->get();
return view('pages.courses')->with('courses', $courses);
}
示例3: main
public function main()
{
$courses = Course::latest('published_at')->Published()->Done()->Paginate(15);
return view('pages.main', compact('courses'));
}
示例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'));
}
示例5: index
public function index()
{
$courses = Course::latest()->get();
return view('course.list', compact('courses'))->with(['title' => 'دوره های آموزشی آنلاین']);
}
示例6: composeNavigation
public function composeNavigation()
{
view()->composer('partials.nav', function ($view) {
$view->with('latest', Course::latest()->first());
});
}
示例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']]);
}