Skip to content

QEDteam/pretty_timestamps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QED Pretty Timestamps

Install

composer require qedteam/pretty_timestamps

Usage

Use trait in model and set up format and timezone

    use PrettyTimestamps\PrettyTimestamps;

    class ModelName extends Model {
        
        use PrettyTimestamps;

        // Pretty timestamp format
        protected $prettyFormat = 'd.m.Y';

        // Pretty timestamp timezone
        protected $prettyNewTimezone = 'CET';

        // Add timestamp + '_pretty' to model appended attributes
        protected $appends = ['created_at_pretty', 'updated_at_pretty'];
    }

Display pretty timestamp

    $model = ModelName::first();
    return $model->created_at_pretty; 

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages