mercredi 5 juin 2019

Laravel | OrderBy related table's column in half-assembled builder

I have half-ready Builder instance:

$builder = PageLang::with(['page', 'version'])
    ->where('page_id', $_GET['id']) 
    ->groupBy('version_id').

And I need to sort result by page column (url). The trick is that I need to do with already half-assembled Builder. I can't do it earlier. So how do I do something like that:

$builder->related('page', function($q) { $q->orderBy... })



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire