I did not deal with dates for some time and totally forgot how it works.
I have a view app that sends the data as 'DD-MM-YYYY', it looks like the date column in MySQL must receive the data as 'YYYY-MM-DD'
Could you please remind me the best way to cast the $request->date to MySQL format but also output the MySQL back to DD-MM-YYYY each time I json response my collections back to vue.
public function setDateAttribute($value)
{
$this->attributes['date'] = Carbon::createFromFormat('d-m-Y', $value);
}
public function getDateAttribute()
{
return $this->date->format('d-m-Y') ?? null;
}