How to change the format of all dates in Laravel8 project
Hi, I am very new to Laravel. Never seen tons of directories before.
I am trying to update an existing inventory system made in Laravel 8. I want to change the date format to d-m-Y wherever the date() is defined. The current date format is (Y-M-d). It's very difficult to locate the forms, table, and JS files. Please help me how to start with.
Thanks in advance
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* Get the user's birth date.
*
* @return \Illuminate\Database\Eloquent\Casts\Attribute
*/
protected function birthDate(): Attribute
{
return Attribute::make(
get: fn ($value) => $value->format('d-m-Y'), //you need to cast date as carbon instance
);
}
}