Do you really have a field with an arrow symbol in the column name? Think about it...
If I understand you have a table with a regions column, which is supposedly a relationship. So just get the objects where the relationship returns an empty object.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there,
I am using a scopeRegion function to filter on items belonging to the current localization region like de, gb, us, ....
The scope looks like this:
public function scopeRegion($query, $locale = null)
{
$locale = ($locale) ?? LaravelLocalization::getCurrentLocale();
$q = clone $query;
$localeRegion = $q->where('regions->' . $locale, true);
if ($localeRegion->count() > 0) {
return $query->where('regions->' . $locale, true);
}
// Check, if assigned to any other region
// Exclude items from query where another region like 'regions->gb' === true
// only fallback, if not restricted to another region
return $query->where('lang', getParentLangByRegion($locale));
}
Is there any way I could exclude items from query if the are assigned to another region like the current one? Only if the are not assigned to any region I would like to pass the fallback.
Cheers
Chris
Please or to participate in this conversation.