Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

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.

0

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

0

Have you tried to compare both result for

$orders = Orders::orderBy('nr_intern', 'DESC')->get(); and $orders = Orders::orderBy('nr_intern', 'ASC')->get();

?

0

Yes, same result. EDIT: Solved. I had an @if statement in my view.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

soluicius soluicius Joined 24 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.