mardi 13 octobre 2020

OrderBy in Laravel 5.2

I have this code in Laravel 5.2 returning a list of installers to a drop-down in my view. I can't get it to orderby the using the query below.

I think it is something to do with the join and perhaps it can't order the collection the way it is loaded but I am struggling to fix this.

Can someone suggest a better way to order by using this code?

$latest_installers = DB::table('sys_installer_version')
    ->join('sys_installer', 'sys_installer.id', '=', 'sys_installer_version.installer_id')
    ->where('sys_installer.active', '1')
    ->where('sys_installer_version.active', '1')
    ->where('sys_installer_version.latest', '1')
    ->orderBy('sys_installer_version.filename', 'desc')
    ->get();

Thanks,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire