本文整理汇总了PHP中app\Post::prevBlogPostUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::prevBlogPostUrl方法的具体用法?PHP Post::prevBlogPostUrl怎么用?PHP Post::prevBlogPostUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Post
的用法示例。
在下文中一共展示了Post::prevBlogPostUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: blog_post
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);
}
示例2: blog_post
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);
}