vendredi 5 mai 2017

How to sort twice with two columns in Laravel?

I am using Laravel 5.4, How to sort twice with two columns?

For example:

ArticleController.php

public function index()
{
    $articles = Auth::user()->articles->sortByDesc('updated_at')->sortByDesc('status');
    return view('index',  compact('articles'));
}

I use sortByDesc() twice,but the result does not follow the rules,what should I do?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire