Skip to content

Instantly share code, notes, and snippets.

@ajay-ag
Last active June 12, 2020 12:10
Show Gist options
  • Save ajay-ag/1124a7631629a6225f635d632b167a9e to your computer and use it in GitHub Desktop.
Save ajay-ag/1124a7631629a6225f635d632b167a9e to your computer and use it in GitHub Desktop.
Date Format Helpler Laravel
<?php
if(!function_exists('dateformat')){
function dateformat($date , $format=null ) {
$setting = Cache::remember('default_setting',600 ,function () {
return \DB::table('settings')->first();
});
$date = Carbon::parse($date)->format($format??$setting->date_format);
return $date;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment