當前位置: 首頁>>代碼示例>>PHP>>正文


PHP News::with方法代碼示例

本文整理匯總了PHP中News::with方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::with方法的具體用法?PHP News::with怎麽用?PHP News::with使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在News的用法示例。


在下文中一共展示了News::with方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     $page = Page::find(1);
     $menuItems = Page::where('parent_id', 0)->get();
     $news = News::with('user')->orderBy('created_at', 'desc')->first();
     return View::make('front.pages.index')->with(['page' => $page, 'news' => $news, 'menuitems' => $menuItems]);
 }
開發者ID:stefferd,項目名稱:schwachofer,代碼行數:7,代碼來源:FrontController.php

示例2: showSinglePressItem

 public function showSinglePressItem($slug, $id)
 {
     $pressItem = News::with('catalog')->find($id);
     if (!$pressItem || !$pressItem->isActive() || $pressItem->getSlug() != $slug) {
         App::abort(404);
     }
     $previousPressItemId = News::active()->where('id', '<', $pressItem->id)->max('id');
     $previousPressItem = News::find($previousPressItemId);
     $nextPressItemId = News::active()->where('id', '>', $pressItem->id)->min('id');
     $nextPressItem = News::find($nextPressItemId);
     return View::make('about.press.single', compact('pressItem', 'previousPressItem', 'nextPressItem'));
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:12,代碼來源:AboutController.php

示例3: index

 public function index()
 {
     $page = Page::find(1);
     $news = News::with('user')->orderBy('created_at', 'desc')->first();
     return View::make('front.pages.index')->with(['page' => $page, 'news' => $news]);
 }
開發者ID:stefferd,項目名稱:superstalling,代碼行數:6,代碼來源:FrontController.php

示例4:

<?
/**
 * TITLE: Новости
 * AVAILABLE_ONLY_IN_ADVANCED_MODE
 */
?>
<?php 
$news_list = News::with('meta.seo', 'meta.photo', 'meta.gallery.photos')->orderBy('published_at', 'DESC')->paginate(6);
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
    <div class="half-page">
        <div class="page-full">
            <div class="wrapper">
                <div class="tabs-title">
                    <h1 class="us-title title-yellow"><span>{{ $page->seo->h1 }}</span></h1>
                    @include(Helper::layout('about-menu'),array('hidden'=>'news'))
                </div>
            </div>
            <div class="us-news">
                <ul class="news__list martop40">
                    @foreach($news_list as $news)
                        <li class="list__item">
                            <div class="wrapper">
                                <div class="page__left">
                                    <h2 class="item__link">
                                        {{ $news->meta->title }}
                                    </h2>
                                    <div class="item__date">
開發者ID:Grapheme,項目名稱:zemaktiv,代碼行數:31,代碼來源:news.blade.php


注:本文中的News::with方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。