假设我有这个:
//controllers/BlogController.php
$data["post"] = $post = Blog::recent_post();
$data["posts_related"] = Blog::posts_related($post->category_id,5);
return View::make('blog.home', $data);
//views/sidebars/related.blade.php
@foreach($posts_related as $r)
<p>{{ $r->name }}</p>
@endforeach
//views/blog/home.blade.php
@include('sidebars.related')
我的问题是,我该如何转移:
$data["posts_related"] = Blog::posts_related($post->category_id,5);
对于视图作曲家,因为似乎我无法将参数传递给视图作曲家,但我不能确定。
我很感激任何帮助!