Starting with Laravel 8, you may define an accessor and mutator using a single, non-prefixed method which returns an Illuminate\Database\Eloquent\Casts\Attribute
.
Before
public function getFirstNameAttribute($value){ return ucfirst($value);} public function setFirstNameAttribute($value){ $this->attributes['first_name'] = strtolower($value);}
After
protected function firstName(): Attribute{ return new Attribute( get: fn ($value) => ucfirst($value), set: fn ($value) => strtolower($value), );}
Sign in with any of the following services to connect Shift with your Laravel project.
Don't use one of these services?
Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.