pooria - 4 weeks ago

Hi

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', '=', 'people_faculty.id')
            ->where('t.locale', \App::getLocale())
            ->orderBy('t.last_name', 'asc')
            ->get();

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 - 4 weeks ago

What's the resulting query? Any clues there?