本文整理汇总了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'));
}
示例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];
}
示例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]);
}
示例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]);
}
示例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'));
}
示例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'));
}
示例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'));
}
示例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'));
}
示例9: news
public function news()
{
$news = News::latest()->paginate(5);
return view('admin.news', compact('news'));
}
示例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);
}