我有select geomfromtext(CONCAT('polygon(',GROUP_CONCAT(a.latitude,' ',a.longitude),'11.12345 66.65432)'))
FROM GeometryTable a
个关系。假设我正在使用many to many
和foo
bar
如何仅显示具有class Foo extends Model
{
public function bars()
{
return $this->belongsToMany(Bar::class);
}
}
class Bar extends Model
{
public function foos()
{
return $this->belongsToMany(Foo::class);
}
}
的{{1}},因此不会显示与Foo
不相关的Bar
记录?...
答案 0 :(得分:0)
您可以使用has方法:https://laravel.com/docs/5.7/eloquent-relationships#querying-relationship-existence
$foos = App\Foo::has('bars')->get();