1
我有两个表之间的关系:博客,图片。如何选择字段不为空的行?
博客模式
public function images(){
return $this->hasMany('App\ImageBlog', 'id_blog', 'id');
}
控制器
$lastPosts = Blog::orderBy('id', 'desc')->with('images')->take(3)->get();
所以,我怎样才能得到最后三行其中images
不为空?
$ lastPosts =博客::排序依据( '身份证', '递减') - >有( '图片') - >与( '图片') - >取(3) - >获得(); –