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


PHP Article::all方法代碼示例

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


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

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $pagesAll = Page::all();
     $articlesAll = Article::all();
     $templatesAll = Template::all();
     $contentAreasAll = ContentArea::all();
     $content_areas = ContentArea::lists('name', 'id');
     $pages = Page::lists('name', 'id');
     $article = Article::findOrFail($id);
     return view('site.edit', compact('article', 'pages', 'content_areas', 'pagesAll', 'articlesAll', 'templatesAll', 'contentAreasAll'));
 }
開發者ID:chrismoulins,項目名稱:Laravel,代碼行數:17,代碼來源:SiteController.php

示例2: forUser

 /**
  * Get all of the articles for a given user.
  **
  *
  * @return mixed
  */
 public function forUser()
 {
     if ($this->user->is_admin) {
         return $this->article->all()->sortBy('created_at');
     }
     return $this->article->where('user_id', $this->user->id)->orderBy('created_at', 'asc')->get();
 }
開發者ID:Dimimo,項目名稱:Booklet,代碼行數:13,代碼來源:ArticleRepository.php

示例3: run

 public function run()
 {
     $article = Article::all()->first();
     DB::table('places')->delete();
     $place = Place::create(array('name' => 'Innocenti Evasioni', 'url' => 'http://www.innocentievasioni.com/', 'address' => 'Via Privata della Bindellina, 20155 Milano', 'lat' => '45.492522', 'lng' => '9.149578', 'status' => Place::GEOLOCALIZED));
     $article->places()->attach($place);
 }
開發者ID:jahnni,項目名稱:onamap,代碼行數:7,代碼來源:DatabaseSeeder.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $teachers = Teacher::topN(6);
     $articles = Article::all();
     $categories_in_pane = ArticleCategory::all();
     return response()->view('site.colabor', array('teachers' => $teachers, 'other_articles' => $articles, 'categories_in_pane' => $categories_in_pane));
 }
開發者ID:ryandong82,項目名稱:zhsite,代碼行數:12,代碼來源:ColaborController.php

示例5: index

 public function index(Request $request)
 {
     $output = Article::all();
     //        $url = $request->url();
     //        dd($url);
     return view('articles.index', compact('output'));
 }
開發者ID:ashishghimire,項目名稱:Simple-blogging-website-using-laravel,代碼行數:7,代碼來源:ArticlesController.php

示例6: getArticle

 public function getArticle($cate, $arti)
 {
     $arti = substr($arti, 0, -5);
     //cắt chuối ".html" cuối article alias
     $category = Category::where("category_alias", $cate)->first();
     //lấy category đầu tiên có alias bằng tham số category alias
     $listCategory = Category::all(["id", "category_alias", "category_name"])->toArray();
     $allArticles = Article::all(["id", "title", "alias", "summary", "content", "image", "category_id", "author", "created_date"])->where('category_id', $category["id"])->toArray();
     //lấy tất cả bài viết trong category
     if ($category != null) {
         $message = "";
         $category_name = $category["category_name"];
         if (count($allArticles) == 0) {
             $message = 'Không có bài viết nào.';
         } else {
             $article = Article::where("alias", $arti)->first();
             if ($article != null) {
                 $relateArticles = Article::where('category_id', $category["id"])->where("id", '!=', $article["id"])->orderBy('created_date', 'desc')->get()->take(2)->toArray();
                 return view('front.blog.article', compact('listCategory', 'relateArticles', 'message', 'category_name', 'article', 'mess'));
             } else {
                 $message = "Không tìm thấy bài viết phù hợp";
                 return view('front.blog.error', compact('listCategory', 'message', 'category_name'));
             }
         }
         return view('blog.index', compact('listCategory', 'message', 'category_name'));
     }
 }
開發者ID:quangtruong16994,項目名稱:laravel,代碼行數:27,代碼來源:BlogController.php

示例7: welcome

 public function welcome()
 {
     $id = 1;
     $parent = Cate::select('id', 'name', 'parent_id')->where('catetype_id', $id)->get()->toArray();
     $article = Article::all();
     return view('welcome', compact('parent', 'article'));
 }
開發者ID:vuongdq,項目名稱:acl-laravel,代碼行數:7,代碼來源:HomeController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //		return view('Admin')->withPages(Page::all());
     //		return view('Admin',['pages'=>Page::all()]);
     return view('Admin')->with('pages', Page::all())->with('articles', Article::all());
     //		$pages['pages'] = Page::all();
     //		return view('Admin',$pages);
 }
開發者ID:willphper,項目名稱:laravel5,代碼行數:13,代碼來源:AdminController.php

示例9: listArticle

 public function listArticle()
 {
     $article = new Article();
     $list = $article->all()->toArray();
     return view('admin.article.index')->with('listArticle', $list);
     //có thể có cách khác assign biến ra
     //return view('article.index',compact('list')); <== phần này ở ngoài sẽ đọc luôn cái list
 }
開發者ID:quangtruong16994,項目名稱:laravel,代碼行數:8,代碼來源:ArticleController.php

示例10: index

 public function index()
 {
     $articles = Article::all();
     if (Request::wantsJson()) {
         return $articles;
     }
     return view('articles.index', compact('articles'));
 }
開發者ID:jp7internet,項目名稱:laravel-apz,代碼行數:8,代碼來源:ArticlesController.php

示例11: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('partials._blog-aside', function ($view) {
         $view->with('postDate', Article::all()->groupBy(function ($date) {
             return Carbon::parse($date->created_at)->format('M-y');
         }));
         $view->with('tags', Tag::all());
     });
 }
開發者ID:Adam-Abstrct,項目名稱:AJDigital,代碼行數:14,代碼來源:ViewComposerServiceProvider.php

示例12: index

 public function index()
 {
     if (!Auth::check()) {
         return redirect('/');
     }
     $users = User::all();
     $articles = Article::all();
     return view('auth.profil', compact('users', 'articles'));
 }
開發者ID:uros262,項目名稱:test_projekat_blog_laravel5,代碼行數:9,代碼來源:UserController.php

示例13: testCreateAndList

 public function testCreateAndList()
 {
     $articleCount = 10;
     for ($i = 1; $i <= $articleCount; $i++) {
         Article::create(['title' => 'subject ' . $i, 'body' => 'body ' . $i]);
     }
     $articles = Article::all();
     $this->assertEquals($articleCount, count($articles));
 }
開發者ID:fxcosta,項目名稱:example-tdd-in-laravel-5,代碼行數:9,代碼來源:ArticleTest.php

示例14: index

 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $articleCount = Article::all()->count();
     $partTypeCount = PartType::all()->count();
     $brandsCount = Brand::all()->count();
     $modelCount = BrandModel::all()->count();
     // dd($articleCount);
     return view('home')->with(['articleCount' => $articleCount, 'partTypeCount' => $partTypeCount, 'brandsCount' => $brandsCount, 'modelCount' => $modelCount]);
 }
開發者ID:zekaroz,項目名稱:Opel,代碼行數:14,代碼來源:HomeController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $article = new Article();
     $article->body = $request->input('body');
     $article->title = $request->input('title');
     $article->save();
     $articles = Article::all();
     dd($articles);
 }
開發者ID:xuewindy,項目名稱:anayami,代碼行數:16,代碼來源:ArticleController.php


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