Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to get last record in eloquent

Model::latest()->first(); // retrieves the last element
Model::orderBy('id', 'desc')->first(); // retrieves all, sort it and get the first
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #record #eloquent
ADD COMMENT
Topic
Name
2+2 =