public function blog_post($url) { $post = Post::whereUrl($url)->first(); $tags = $post->tags; $prev_url = Post::prevBlogPostUrl($post->id); $next_url = Post::nextBlogPostUrl($post->id); $title = $post->title; $description = $post->description; $page = 'blog'; $brands = $this->brands; $categories = $this->categories; $products = $this->products; $data = compact('prev_url', 'next_url', 'tags', 'post', 'title', 'description', 'page', 'brands', 'categories', 'products'); return view('blog_post', $data); }
public function blog_post($url) { $post = \App\Post::where('url', '=', $url)->get(); $post_id = $post[0]['id']; $tags = \App\BlogPostTag::postTags($post_id); $previous_url = \App\Post::prevBlogPostUrl($post_id); $next_url = \App\Post::nextBlogPostUrl($post_id); $data['previous_url'] = $previous_url; $data['next_url'] = $next_url; $data['tags'] = $tags; $data['post'] = $post[0]; $data['title'] = $post[0]['title']; $data['description'] = $post[0]['description']; $data['page'] = 'blog'; $data['brands'] = $this->brands; $data['categories'] = $this->categories; $data['products'] = $this->products; return view('blog_post', array('data' => $data, 'title' => $post[0]['title'], 'description' => $post[0]['description'], 'page' => 'blog', 'brands' => $this->brands, 'categories' => $this->categories, 'products' => $this->products)); // $data = compact('prev_url', 'next_url', 'tags', 'post', 'title', 'description', 'page', 'brands', 'categories', 'products'); // return $data; return view('blog_post', $data); }