MattB
1 week ago
1199
13
Eloquent

Order By not working

Posted 1 week ago by MattB

What have I done wrong here? Is it how I've strung the query together? I have the below query:

 $companies = Category::all()->groupBy('company')->OrderBy('company', 'asc');

Which results in the following error:

Method Illuminate\Database\Eloquent\Collection::OrderBy does not exist.

Have I just done it in the wrong order or something?

Please sign in or create an account to participate in this conversation.