本文整理汇总了PHP中Blog::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::with方法的具体用法?PHP Blog::with怎么用?PHP Blog::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::with方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detail
public function detail($id)
{
$article = Blog::with('user')->where('id', '=', $id)->first();
if (!$article) {
return 'MAKALE BULUNAMADI!';
}
return View::make('blog.detail', compact('article'));
}
示例2: index
public function index()
{
$blogs = Blog::with('author')->orderBy('created_at', 'desc')->take(10)->get();
$events = Events::with('author')->orderBy('created_at', 'desc')->take(8)->get();
$groups = Group::with('author')->orderBy('created_at', 'desc')->take(8)->get();
$photos = Photo::with('author')->orderBy('created_at', 'desc')->take(8)->get();
return View::make('home.index')->with('blogs', $blogs)->with('events', $events)->with('groups', $groups)->with('photos', $photos);
}
示例3: action_index
public function action_index()
{
// lets get our posts and eager load the
// author
$blogs = Blog::with('author')->order_by('created_at', 'desc')->take(10)->get();
// show the home view, and include our
// posts too
//$posts->appends(array('a' => 'app'));
return View::make('home.index')->with('blogs', $blogs);
}
示例4: index
public function index()
{
//博客首页
$blogs = Blog::with('author')->orderBy('created_at', 'desc')->paginate(20);
return View::make('blog.index')->with('blogs', $blogs);
}