Laravel связи между таблицами Belongstomany по нескольким условиям
Есть таблицы
"pois" (достопримечатльности)
"locations" (местоположения)
"tags" (метки)
"pois_locations" (пивот 1)
"pois_tags" (пивот 2)
В модели Locations
public function pois()
{
return $this->belongsToMany(Pois::class, 'pois_locations');
}
В модели Pois
public function locations()
{
return $this->belongsToMany(Locations::class, 'pois_locations');
}
public function tags()
{
return $this->belongsToMany(Tags::class);
}
В модели Tags
public function pois()
{
return $this->belongsToMany(Pois::class, 'pois_tags');
}
Заданы $current_location->id локации и $current_tag->id тега
Как получить по нему все pois в данной локации И с заданным тегом?
$pois=Pois::where('status','=',1) ....