public function filterJoinedRelation($related)
{
// Apply any relation based scope to avoid method duplication
$this->callRelatedLocalSetup($related, $this->query);
foreach ($this->getLocalRelation($related) as $closure) {
// If a relation is defined locally in a method AND is joined
// Then we call those defined relation closures on this query
$closure($this->query);
}
// Check if we have input we need to pass through a related Model's filter
// Then filter by that related model's filter
if (count($relatedFilterInput = $this->getRelatedFilterInput($related)) > 0) {
$filterClass = $this->getRelatedFilter($related);
// Disable querying joined relations on filters of joined tables.
(new $filterClass($this->query, $relatedFilterInput, false))->handle();
}
}