Shift with red gradient lettering

Convert dates property

Laravel
Legacy Code

Remove the model $dates property and register custom fields as datetime within the casts property. The $dates property was deprecated in Laravel 8 and removed in Laravel 10.

Before

public User extends Model
{
protected $casts = [
'id' => 'integer',
];
 
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
'expired_at'
];
 
// ...
}

After

public User extends Model
{
protected $casts = [
'id' => 'integer',
'expired_at' => 'datetime',
];
 
// ...
}

← Back to the Workbench Tasks

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.