It is not quite clear to me what exactly you want to do... Let me give a shot
- If your date is stored as one of the SQL
datetypes (datetime,date, etc.) and you want Eloquent to automatically convert them to aCarboninstance, just override Eloquent'sgetDates()method:
public function getDates()
{
return ['created_at', 'updated_at', 'custom_date'];
}
There is no need to write an acessor for that.
- The form part is what I did not understand, do you want to manipulate the
Carboninstance prior to populating the form?
If so, and if you are using plain HTML, I think this will do it:
<input type="date" name="custom_date" value="{{ old('custom_date', $model->custom_date->addDay()->format('Y-m-d')) }}">
As you mentioned you are using Form model binding, I think the easiest way is to update your custom date attribute before sending the model to the view.