Search
 
SCRIPT & CODE EXAMPLE
 

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();
Comment

PREVIOUS NEXT
Code Example
Php :: yii2 redirect with 301 
Php :: php code to hide plugin update for wordpress 
Php :: opencart add custom description meta tag using controller file 
Php :: how can we use two php version in mac os 
Php :: php mysql datetime format string 
Php :: twig dd 
Php :: Wordpress Pagination for WP_Query 
Php :: php 301 redirect 
Php :: Internal error: xmlSchemaXPathProcessHistory, The state object to be removed is not the first in the list. 
Php :: laravel now date 
Php :: get count of relationship table laravel 
Php :: laravel upload image to public folder 
Php :: whats the meaninig of void functions in php 
Php :: disable edit-link storefront 
Php :: php datetime create 
Php :: xampp check php version 
Php :: melhor linguagem de programação 
Php :: laravel gigapay create employee 
Php :: one item limit on cart in woocommerce 
Php :: php merge 2 arrays 
Php :: take fraction of number in laravel 
Php :: php remove class attribute 
Php :: PHP strlen — Get string length 
Php :: get the last inserted id using laravel eloquent 
Php :: remove special character in php 
Php :: make pagination wordpress admin panel 
Php :: laravel ide-helper 
Php :: laravel not in query 
Php :: laravel create project thorugh composer 
Php :: php date month italian 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =