Laravel order by date not working

Updated at 24-Sep-2021, By samar

Laravel order by date not working

Through many examples, we will learn how to resolve the "Laravel order by date not working".

Sometimes you have to get data in order by date in laravel. There could be any issue in query while getting records in order from the table that's why laravel order by date not working in your case. Try below code snippet
  • OrderBy method on created_at column in laravel

    Route::get('/order-by', function(){
        $users = App\Models\User::orderBy('created_at', 'desc')->get();
        dd($users);
    });
    

Back to code snippet queries related laravel