In a Laravel model it is possible to casts fields as Carbon dates like so:
class Example extends Model
{
protected $casts = [
'date_of_birth' => 'date'
]
}
However this can also be done like so:
class Example extends Model
{
protected $dates= [
'date_of_birth'
]
}
What is the difference and what is the recommended way of doing this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire