Custom DateTime Fields (nice trick to make Laravel recognize it)

Submitted by kbirmhrjn - 4 years ago

If you have datetime fields lets say, last_updated or registered_at, this is a nice trick to make laravel know about that fields & let it know. Just overwrite Eloquent's constants.

User extends Eloquent{
    
    const CREATED_AT = 'registered_at';

    const UPDATED_AT = 'last_updated';
    
    const DELETED_AT = 'deleted_on';
}
comments powered by Disqus