当前位置: 首页>>代码示例>>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;未经允许,请勿转载。