I've seen a couple of times Laravel people order by a relation like this:
Model::with(["relationship" => function($query) {
$query->orderBy('relation_property');
}]);
I've never got this working. Although, it seams like many people is using it. Does someone having an idea why I cant get it to order the result by the relations property?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire