Laravel Eloquent: Ordering results of all()

后端 未结 10 1499
野的像风
野的像风 2020-12-07 10:09

I\'m stuck on a simple task. I just need to order results coming from this call

$results = Project::all();

Where Project is

10条回答
  •  囚心锁ツ
    2020-12-07 11:02

    2017 update


    Laravel 5.4 added orderByDesc() methods to query builder:

    $results = Project::orderByDesc('name')->get();
    

提交回复
热议问题