Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel get latest record by date

use orderbBy():

TblModel::orderBy('date','DESC')->first();

Or

DB::table('tbl')->orderBy('date', 'DESC')->first();

Update:
TblModel::where('date', TblModel::max('date'))->orderBy('date','desc')->get();
Source by laraveltuts.com #
 
PREVIOUS NEXT
Tagged: #laravel #latest #record #date
ADD COMMENT
Topic
Name
7+3 =