<tr>
<th>Start Date</th>
<td>{{ $data['offer']->started_date->diffForHumans() }}</td>
</tr>
<tr>
<th>End Date</th>
<td>{{ $data['offer']->end_date->diffForHumans() }}</td>
</tr>
in model
protected $casts = [
'started_date' => 'datetime:Y-m-d\TH:i',
'end_date' => 'datetime:Y-m-d\TH:i'
];
public function setStartedDateAttribute($value){
$this->attributes['started_date'] = Carbon::parse($value);
}
public function setEndDateAttribute($value){
$this->attributes['end_date'] = Carbon::parse($value);
}
0 Comments