All individual subscriptions are 50% off this week only!

1 month ago

Order By not working

Posted 1 month 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.