Hi i am trying to get a user and there images, ordered by the primary column which is either 1 or 0
$user = User::with('image')->whereUsername($username)->whereHas('image', function ($query) {
$query->orderBy('primary', 'desc');
})->firstOrFail();
however this query return the user and there images of which there is three of them but they are always in the same order, which is not the descending order and appears to be in ID order, am i missing something here?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1hrMbb2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire