Sort by translated column
Created 5 years ago by pooria


I'm trying to sort the results by a column in translated table. I'm using this code:

$arr = FacultyModel::join('people_faculty_translations as t', 't.entry_id', '=', '')
            ->where('t.locale', \App::getLocale())
            ->orderBy('t.last_name', 'asc')

But the problem is that by doing this, The relationships become empty. For example when I try to get $arr[0]->articles It returns an empty array, but when I use $arr = FacultyModel::all() to retrieve data, $arr[0]->articles works!

ryanthompson  —  5 years ago

What's the resulting query? Any clues there?