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


PHP Article::all方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $posts = Article::all();
     // $data = compact('posts');
     $data = ['posts' => $posts];
     return view('blog', $data);
 }
开发者ID:TenTail,项目名称:Laravel-Blog-Test,代码行数:12,代码来源:BlogController.php

示例2: index

 public function index()
 {
     $users = User::all()->count();
     $trusts = Trusts::groupBy("registry")->get()->count();
     $articles = Article::all()->count();
     return view('admin/dashboard')->with(['users' => $users, 'trusts' => $trusts, 'articles' => $articles]);
 }
开发者ID:pjnovas,项目名称:fideicomisos2015,代码行数:7,代码来源:Admin.php

示例3: laravel

 public function laravel()
 {
     /*
      * 查询所有的记录
      * */
     $list = \App\Models\Article::all()->toArray();
     p($list);
     /*
     * 查询一条记录并转化为数组
     		$list = \App\Models\Article::first()->toArray();
     		p($list);
     */
     /*
     * 查询指定记录
     * 
     		$list = \App\Models\Article::find(1)->toArray();
     		p($list);
     */
     /*
      * 删除指定记录
     $status = \App\Models\Article::where('id', '=', 11)->delete();;
     p($status);
     */
     // 更多请自己查看Eloquent ORM 开发手册
 }
开发者ID:phpdn,项目名称:skphp,代码行数:25,代码来源:DbController.php

示例4: index

 public function index()
 {
     $main_article = Article::all()->first();
     $articles = Article::all();
     $categories = ['branch', 'type', 'scope', 'theme', 'unit', 'settlor', 'fiduciary'];
     $year_max = max(Trusts::select("year")->groupBy("year")->get()->toArray());
     $year = $year_max["year"];
     $definitions = Definitions::all();
     $category = $definitions->where("name", "branch")->first();
     $trusts = Trusts::groupBy("registry")->select("id", "branch", "type", "scope", "theme", "unit", "settlor", "fiduciary", 'income', 'yield', 'expenses', 'availability', 'initial_amount', 'year')->where("year", $year)->get();
     return view('home')->with(['main_article' => $main_article, 'articles' => $articles, 'file_url' => '/images/articles/', 'months' => $this->months, 'trusts' => $trusts, 'categories' => $categories, 'category' => $category, 'definitions' => $definitions, 'year' => $year]);
 }
开发者ID:pjnovas,项目名称:fideicomisos2015,代码行数:12,代码来源:Home.php

示例5: index

 public function index($api)
 {
     $articles = Article::all();
     $output = '';
     foreach ($articles as $post) {
         $output .= $post->title;
         $output .= ' ';
     }
     if ($api) {
         return response()->json($output);
     } else {
         return $output;
     }
 }
开发者ID:RenaudDahl,项目名称:LumenBlog,代码行数:14,代码来源:ArticleController.php

示例6: getAllArticles

 public function getAllArticles()
 {
     return Article::all();
 }
开发者ID:Alewex,项目名称:e9d5895154c2305c2941e6f659a8aa0e,代码行数:4,代码来源:HomeController.php

示例7: function

        $data->update(['article_title' => 'update test=3=.', 'feature' => false]);
        // save方法
        $data = \App\Models\Articles::where('id', '=', 11)->first();
        $data->article_title = 'update test -3-.';
        $data->feature = true;
        $data->save();
    }]);
    Route::get('delete', ['as' => 'ORM.delete', function () {
        $data = \App\Models\Articles::find(2);
        $data->delete();
        \App\Models\Articles::destroy(19, 20);
    }]);
});
Route::get('test', function () {
    // $data = \App\Models\Article::find(5);
    $data1 = \App\Models\Article::all();
    $data2 = \App\Models\Article::where('id', '>', 8);
    $data3 = \App\Models\Article::orderBy('id', 'DESC');
    dd([$data1, $data2, $data3]);
});
/*
Route::get('hello', function(){
	return "Hello World!";
});

Route::get('post/{id}', function($id) {
	return "id:".$id;
})->where('id', '[0-9]+');

// route name
Route::get('post2/{id?}', ['as' => 'post2.show', function($id = 0) {
开发者ID:TenTail,项目名称:Laravel-Blog-Test,代码行数:31,代码来源:routes.php

示例8: index

 public function index()
 {
     $articles = Article::all();
     return view('admin.articles')->with('articles', $articles);
 }
开发者ID:pjnovas,项目名称:fideicomisos2015,代码行数:5,代码来源:AdminArticles.php

示例9: renderAll

 /**
  * @param int $number
  * @return Collection
  */
 public static function renderAll($number = 0)
 {
     /** @var Collection $all */
     $all = Article::all();
     if ($number > 0) {
         $all = $all->random($number);
     }
     foreach ($all as $i) {
         /** @var Article $i */
         $i->append(['first_related_destination', 'thumbnail', 'view_url']);
     }
     return $all;
 }
开发者ID:hungphongbk,项目名称:ulibi,代码行数:17,代码来源:Article.php

示例10: index

 public function index()
 {
     return \View::make('admin.articles.index')->with('articles', Article::all());
 }
开发者ID:daniellimafreire,项目名称:l4-site-tutorial,代码行数:4,代码来源:ArticlesController.php

示例11: all

 public function all()
 {
     $articles = Article::all();
     return view('reports')->with(['articles' => $articles, 'file_url' => '/images/articles/', 'months' => $this->months]);
 }
开发者ID:pjnovas,项目名称:fideicomisos2015,代码行数:5,代码来源:Articles.php

示例12: index

 public function index()
 {
     $articles = Article::all();
     return $articles;
 }
开发者ID:eco-nomix,项目名称:deployed,代码行数:5,代码来源:ArticlesController.php

示例13: getIndex

 public function getIndex()
 {
     $data = ['list' => Article::all()];
     return View::make('admin.article', $data);
 }
开发者ID:alfhan,项目名称:dishubparpostel,代码行数:5,代码来源:ArticleController.php

示例14: count

<ul class="sidebar-menu">
    <li>
        <a href="/">
            <i class="glyphicon glyphicon-play-circle icon-sidebar"></i>START
        </a>
    </li>
    <li>
        <a href="/categories">
            <i class="glyphicon glyphicon-th icon-sidebar"></i>Categories
        </a>
        <ul class="submenu">
            <?php 
$cats = \App\Models\Category::all();
$aNum = count(\App\Models\Article::all());
?>
            <li><a style="color: #5bc0de;" href="/articles">All Articles <span class="label label-success span-sidebar">{{
            $aNum
            }}</span></a></li>
            @if($cats)
                @foreach($cats as $cat)
                <li><a href="/category/{{ $cat->id }}">{{ $cat->name }}</a></li>
                @endforeach
            @else
                <li><a href="javascript:;">...</a></li>
            @endif
        </ul>
    </li>
    <li>
        <a href="/about">
            <i class="glyphicon glyphicon-headphones icon-sidebar"></i>
            <i class="fa fa-angle-right chevron-icon-sidebar"></i>
开发者ID:kaiyulee,项目名称:express,代码行数:31,代码来源:sidebar_menu.blade.php

示例15: indexContent

 public function indexContent()
 {
     return view('admin.index_content')->with('pages', Page::take(20)->get())->with('articleCats', ArticleCat::all())->with('articles', Article::all());
 }
开发者ID:Zachary-Leung,项目名称:wine_platform,代码行数:4,代码来源:AdminHomeController.php


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