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


PHP News::all方法代码示例

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


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

示例1: frontendIndex

 public function frontendIndex(Request $request)
 {
     $page = $request->input('page', 1);
     $limit = 20;
     $offset = ($page - 1) * $limit;
     $result = News::offset($offset)->take($limit)->get();
     $result1 = DB::table('parent_menu')->get();
     $siteTitle = Setting::where('name', 'title')->get();
     if (count($siteTitle) > 0) {
         $bah = $siteTitle->first()->value;
     } else {
         $bah = 'Website';
     }
     $footer = Setting::where('name', 'footer')->get();
     if (count($footer) > 0) {
         $footer = $footer->first()->value;
     } else {
         $footer = '(c) 2015, Ordent, All Right Reserved.';
     }
     $logo = Setting::where('name', 'logo')->get();
     if (count($logo) > 0) {
         $logo = asset('/uploads/logo/') . '/' . $logo->first()->value;
         $logo = preg_replace('/\\s+/', '', $logo);
     } else {
         $logo = '#';
     }
     $count = ceil(count(News::all()) / 20);
     return view('frontend.news-index', compact('result', 'title', 'result1', 'footer', 'count', 'logo'));
 }
开发者ID:k1m0ch1,项目名称:egor,代码行数:29,代码来源:NewsController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $news = News::all()->where('status_id', 3);
     return view('front.news.index', compact('news'));
 }
开发者ID:svetlana-topalova,项目名称:news-portal,代码行数:10,代码来源:IndexController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return $news = News::all();
     return $news;
 }
开发者ID:nvchernov,项目名称:tsargrad,代码行数:10,代码来源:NewsController.php

示例4: admin

 /**
  * Display a listing of the resource in administration side.
  *
  * @return Response
  */
 public function admin()
 {
     $news = News::all();
     return view('news.backend.index', compact('news'));
 }
开发者ID:danielchikaka,项目名称:osh,代码行数:10,代码来源:NewsController.php

示例5:

                        <br/><br/>
                            <div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                   <thead>
                                        <tr>
                                            <th>Title</th>
                                            <th width="30%">Category</th>
                                            <th width="10%">Edit</th>
                                            <th width="10%">Delete</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php 
use App\Models\News;
use App\Models\Category;
$news = News::all();
?>
                                         @foreach ($news as $item)
                                            <tr>
                                                <td><?php 
echo $item->nTitle;
?>
</td>
                                                <td><?php 
echo Category::find($item->catId)->catName;
?>
</td>
                                                <td><a href="{{URL::to('news/edit',$item->nId)}}">Edit</a></td>
                                                <td><a href="{{URL::to('deleteNews',$item->nId)}}" onclick="if(!confirm('Are you sure to delete this item?')){return false;};" title="Delete this Item">Delete</a></td>
                                            </tr>
                                        @endforeach
开发者ID:haclongkim,项目名称:newsedu,代码行数:31,代码来源:ManagerNews.blade.php


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