Level 47
What if you tried putting your date only fields into $casts instead?
protected $casts = [
'billed_at' => 'date',
...
];
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I cast the date fields as this in the eloquent model :
protected $dates = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
'deleted_at' => 'datetime:Y-m-d H:i:s',
'billed_at' => 'date:Y-m-d',
'payed_at' => 'date:Y-m-d',
'due_date' => 'date:Y-m-d',
];
created_at, updated_at and deleted_at are stored as TIMESTAMPbilled_at, payed_at and due_date are stored as DATE in MysqlIn my Nova Resource, if I use the Date field I have the error
date field must cast to 'date' in eloquent model
And this is how the fields are set
Date::make('Billed At', 'billed_at'),
Date::make('Payed At', 'payed_at'),
Date::make('Due Date', 'due_date'),
What am I missing ?
Please or to participate in this conversation.