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


PHP News::latest方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $sliders = Slider::latest()->get();
     $images = Image::latest()->take(4)->get();
     $news = News::latest('published_at')->published()->take(3)->get();
     $articles = Article::latest('published_at')->published()->take(3)->get();
     return view('pages.index', compact('articles', 'news', 'images', 'sliders'));
 }
开发者ID:kobeuu,项目名称:bpb-sf,代码行数:13,代码来源:PagesController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @return Response
  */
 public function show()
 {
     $offset = Input::get('offset');
     $news = App\News::latest('created_at')->skip($offset)->take(6)->get();
     \DB::table('news')->count() > 7 + $offset ? $hide = false : ($hide = true);
     foreach ($news as $item) {
         $item['url'] = IndexController::translitURL($item['title']);
         $item['created'] = IndexController::restyleDate($item['created_at']);
     }
     return ['news' => $news, 'hide' => $hide];
 }
开发者ID:ArtiResh,项目名称:mytest,代码行数:16,代码来源:IndexController.php

示例3: showNewsAction

 public function showNewsAction()
 {
     if (!Request::has('page_number')) {
         $page_number = 1;
     } else {
         $page_number = Request::input('page_number');
     }
     $news = News::latest('created_at')->skip(($page_number - 1) * 5)->take(5)->get();
     $news_amount = count(News::all());
     return view('base.news', ['news' => $news, 'page_number' => $page_number, 'news_amount' => $news_amount]);
 }
开发者ID:chelizminska,项目名称:laravel_new,代码行数:11,代码来源:BaseController.php

示例4: news

 public function news($page)
 {
     Carbon::setLocale('nl');
     $posts = News::all()->count();
     $pages = ceil($posts / 3);
     if ($page > $pages) {
         return redirect('nieuws/pagina-1');
     }
     $news = News::latest()->skip(($page - 1) * 3)->take(3)->get();
     return view('pages.public.news')->with(['news' => $news, 'page' => $page, 'pages' => $pages]);
 }
开发者ID:svuvis,项目名称:oshusite,代码行数:11,代码来源:PublicController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $news = News::latest()->get();
     return view('news.index', compact('news'));
 }
开发者ID:pz6tnk,项目名称:laravel-CRM,代码行数:10,代码来源:NewsController.php

示例6: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $newslist = News::latest('published_at')->published()->paginate(10);
     return view('frontend.news', compact('newslist'));
 }
开发者ID:lynnyenn,项目名称:taos2lumen,代码行数:10,代码来源:NewsController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $news = News::latest('published_at')->published()->paginate(3);
     return view('news.index', compact('news'));
 }
开发者ID:kobeuu,项目名称:bpb-sf,代码行数:10,代码来源:NewsController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //$news = News::latest('date')->simplePaginate(10);
     $news = News::latest('date')->paginate(10);
     return view('news', compact('news'));
 }
开发者ID:RelmekTaiwan,项目名称:sebamed,代码行数:11,代码来源:NewsController.php

示例9: news

 public function news()
 {
     $news = News::latest()->paginate(5);
     return view('admin.news', compact('news'));
 }
开发者ID:kobeuu,项目名称:bpb-sf,代码行数:5,代码来源:AdminController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $news = News::latest()->get();
     return view('pages.admin.news.index')->with('news', $news);
 }
开发者ID:svuvis,项目名称:oshusite,代码行数:10,代码来源:NewsController.php


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