Exemplo n.º 1
0
 /**
  * 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'));
 }
 /**
  * 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'));
 }
Exemplo n.º 3
0
 /**
  * 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'));
 }
Exemplo n.º 4
0
 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');
 }
Exemplo n.º 5
0
 /**
  * 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();
     });
 }
Exemplo n.º 6
0
 /**
  * GET /posts
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $posts = Post::published()->get();
     return view('post.index', compact('posts'));
 }
Exemplo n.º 7
0
 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'));
 }
Exemplo n.º 8
0
 /**
  * @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'));
 }
Exemplo n.º 9
0
 /**
  * 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]);
 }