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... })



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2QNcM50
via IFTTT

Aucun commentaire:

Enregistrer un commentaire