Unexpected data found during save on eloquent / Laravel

You array returned from getDates was merged with the dafault one resulting in:

['created_at','updated_at','deleted_at','date','created_at','updated_at'];

so use only 'date' there and should be fine.


Try setting up a mutator for 'date' to convert the data from input into timestamp format. The error you get is not on Eloquent but Carbon.

public function setDateAttribute($value)
{
    $this->attributes['date'] = Carbon\Carbon::createFromFormat('d-m-Y h:i', $value);
}

Also there is mistake in the docs, as getDates defines date accessors, not mutators..


Try this:

Carbon::createFromFormat('d.m.Y H:i', $request->publishdate);