Answer the question
In order to leave comments, you need to log in
Why is the Unexpected data found error displayed?
Task: add the ability to specify the time for the published_at attribute.
<div class="form-group">
{!! Form::label('published_at',"Дата публикации :") !!}
{!! Form::input('datetime-local', 'published_at', date('Y-m-d H:i'), ['class' => 'form-control', 'min' => date('Y-m-d') ]) !!}
</div>
public function setPublishedAtAttribute($date) {
//dd($date);
$this->attributes['published_at'] = Carbon::createFromFormat('Y-m-d H:i', $date)->format('Y-m-d H:i');
}
"2018-07-18T15:15"
InvalidArgumentException
The timezone could not be found in the database Data missing
Answer the question
In order to leave comments, you need to log in
Escape the time zone abbreviation "T"Carbon::createFromFormat('Y-m-d\TH:i', $date)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question