I am trying to understand accessors & mutators and why I need them. And my another ask is the middle part of an attribute's method for an example:
Accessor:
public function getFirstNameAttribute($value)
{
return ucfirst($value);
}
Mutator:
public function setFirstNameAttribute($value)
{
$this->attributes['first_name'] = strtolower($value);
}
Here, we can see getFirstNameAttribute and setFirstNameAttribute methods and I haven't been able to clear the middle part FirstName of them. I will really be grateful for a better explanation and kind cooperation.