Hello,
what you want to do dude? if you need to find single item do
eg: $orders = Orders::orderBy('nr_intern', 'desc')->find(1);
for getting all
eg: $orders = Orders::orderBy('nr_intern', 'desc')->all();
or just get
eg: $orders = Orders::orderBy('nr_intern', 'desc')->get();
for first
eg: $orders = Orders::orderBy('nr_intern', 'desc')->first();
this will give you proper data other you will get all un wanted object data.
I have a table containing all orders. I want to order them in the table by nr_intern. eg: $orders = Orders::orderBy('nr_intern', 'desc')->all(); -> Doesn't work: Call to undefined method Illuminate\Database\Query\Builder::all(); eg: $orders = Orders::orderBy('nr_intern', 'desc')->get(); -> Doesn't work: the orders aren't ordered. Thank you:D And sorry, i'm new in laravel:D
Have you tried to compare both result for
$orders = Orders::orderBy('nr_intern', 'DESC')->get(); and $orders = Orders::orderBy('nr_intern', 'ASC')->get();
?
Yes, same result. EDIT: Solved. I had an @if statement in my view.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community