Complete the code to define an accessor method in a Laravel model.
public function get[1]Attribute() { return strtoupper($this->attributes['name']); }
Accessor methods in Laravel models use the format get{AttributeName}Attribute with the attribute name in StudlyCase.
Complete the code to define a mutator method in a Laravel model.
public function set[1]Attribute($value) { $this->attributes['name'] = strtolower($value); }
Mutator methods use the format set{AttributeName}Attribute with the attribute name in StudlyCase.
Fix the error in the accessor method name to follow Laravel conventions.
public function get[1]() { return ucfirst($this->attributes['title']); }
Accessor methods must be named get{AttributeName}Attribute to work properly in Laravel.
Fill both blanks to create a mutator that stores the email attribute in lowercase.
public function set[1]Attribute($value) { $this->attributes['email'] = [2]($value); }
The mutator method name uses StudlyCase attribute name 'Email'. The value is converted to lowercase using strtolower.
Fill all three blanks to create an accessor that returns the user's full name in uppercase.
public function get[1]Attribute() { return strtoupper($this->attributes['[2]'] . ' ' . $this->attributes['[3]']); }
The accessor method name uses 'FullName' in StudlyCase. It combines 'first_name' and 'last_name' attributes and converts them to uppercase.