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