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