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


PHP Post::published方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $jobs = Job::take(6)->get();
     $posts = Post::published()->orderBy('created_at', 'desc')->where('category_id', '1')->get()->take(3);
     $vignettes = Post::published()->orderBy('created_at', 'desc')->where('category_id', '1' and 'is_sticky', '0')->skip(3)->take(6)->get();
     return view('pages.home.index', compact('jobs', 'posts', 'vignettes'));
 }
开发者ID:celine24,项目名称:Back,代码行数:12,代码来源:HomeController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $post = Post::findOrFail($id);
     $articles = Post::published()->get();
     $user = Auth::user();
     $post->load('user', 'comments');
     return view('posts.post', compact('post', 'articles', 'user'));
 }
开发者ID:HugoGit,项目名称:Laravel-5-Portfolio,代码行数:14,代码来源:PostsController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $posts_published = Post::published()->count();
     $posts_editing = Post::where('published', 'uc')->count();
     $posts_sticky = Post::where('is_sticky', 'on')->count();
     $posts = Post::count();
     $users = User::count();
     $jobs = Job::count();
     $questions = Question::count();
     $categories = Category::count();
     return view('admin.stats.index', compact('posts', 'posts_published', 'posts_sticky', 'posts_editing', 'users', 'jobs', 'questions', 'categories'));
 }
开发者ID:celine24,项目名称:Back,代码行数:17,代码来源:StatsController.php

示例4: index

 public function index()
 {
     $parsedown = new \ParsedownExtra();
     $config = Configuration::find(1);
     $posts = Post::published()->orderBy('published_at', 'desc')->get();
     $feed = new Feed();
     $channel = new Channel();
     $channel->title($config->blog_title)->description($config->blog_description)->url(url('/'))->appendTo($feed);
     foreach ($posts as $post) {
         $item = new Item();
         $item->title($post->title)->description($parsedown->parse($post->content))->url(url("/articles/{$post->slug}"))->guid(url("/articles/{$post->slug}"), true)->appendTo($channel);
     }
     return response($feed)->header('Content-Type', 'application/rss+xml');
 }
开发者ID:vladzur,项目名称:werken,代码行数:14,代码来源:RssController.php

示例5: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('posts', function ($id) {
         return \App\Post::published()->findOrFail($id);
     });
     $router->bind('users', function ($id) {
         return \App\User::findOrFail($id);
     });
     $router->bind('roles', function ($name) {
         return \App\Role::where('role', $name)->firstOrFail();
     });
     $router->bind('comments', function ($id) {
         return \App\Comment::findOrFail($id);
     });
     $router->bind('tags', function ($name) {
         return \App\Tag::where('name', $name)->firstOrFail();
     });
 }
开发者ID:TraianAlex,项目名称:laravel4,代码行数:25,代码来源:RouteServiceProvider.php

示例6: index

 /**
  * GET /posts
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $posts = Post::published()->get();
     return view('post.index', compact('posts'));
 }
开发者ID:spitzgoby,项目名称:spitzgoby,代码行数:10,代码来源:PostsController.php

示例7: allArticlesUser

 public function allArticlesUser($id)
 {
     $user = User::findOrFail($id);
     $vignettes = Post::published()->where('user_id', $user->id)->where('category_id', '1')->orderBy('created_at', 'desc')->get();
     return view('pages.blog.all-articles-user', compact('user', 'vignettes'));
 }
开发者ID:celine24,项目名称:Back,代码行数:6,代码来源:BlogController.php

示例8: showPost

 /**
  * @return the selected post
  * @param $id
  * @param string $slug
  */
 public function showPost($id, $slug = '')
 {
     $post = Post::published($id)->first();
     $comments = Comment::commentPublished($post->id)->get();
     return view('front.single', compact('post', 'comments'));
 }
开发者ID:AndryRana,项目名称:ConfPHP,代码行数:11,代码来源:ConfPhpController.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $configuration = Configuration::find(1);
     $posts = Post::published()->orderBy('published_at', 'desc')->simplePaginate(5);
     return view('posts/index', ['posts' => $posts, 'configuration' => $configuration]);
 }
开发者ID:vladzur,项目名称:werken,代码行数:11,代码来源:PostsController.php


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