Level 50
{{ now($product->date)->addDays(5) }}
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello
In balade showing data type field
{{$product->date}} which showing 2022-02-22
I add + 5 day and show 2022-02-27
The date column is not correctly stored so the value is invalid date string. You can try by parsing like this:
{{ now()->parse($product->date)->addDays(5) }}
Or, better you can add cast in the Product Model.
protected $casts = [
'date' => 'datetime:Y-m-d',
];
Please or to participate in this conversation.