jeudi 31 mars 2016

Laravel 5 eloquent order by subtraction

How to perform this query using Eloquent

select * from `reviews` order by `up_vote` - `down_vote` desc

I am trying to do something like this:

$top_reviews = $reviews->orderBy('up_vote - down_vote','DESC')->get();

But I am getting Unknown column 'up_vote - down_vote'. Is it possible to do this without using DB ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1onMNRu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire