This is the solution from an IRC user JasonLewis
public function scopeCityName($query)
{
return $query
->join('cities', 'cities.id', '=', 'realestates.city_id')
->join('city_translations', 'cities.id', '=', 'city_translations.city_id')
->join('languages', 'city_translations.language_id', '=', 'languages.id')
->where('languages.code','=',Session::get('my.lang'))
->where('realestates.id','=',$this->id)
->select('city_translations.name as name')->pluck('name');
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community