Adding custom date fields for processing with Carbon object

Sometimes besides created_at and updated_at we may need another custom date fields which can be needed to process with Carbon object. So, we need to define those with $dates variable in model.

// In model
protected $dates= ['upgraded_at', 'paid_at', 'purchase_time']

Related Posts


Changing timestamp field names

Setting up custom date format

Using fillable or guarded