Shift with red gradient lettering

Adopt Scope attribute

Laravel

Convert local model scopes from the scope method name prefix to the #[Scope] PHP attribute added in Laravel 12.

Before

protected function scopePopular(Builder $query): void
{
$query->where('votes', '>', 100);
}

After

#[Scope]
protected function popular(Builder $query): void
{
$query->where('votes', '>', 100);
}

← Back to the Workbench Tasks

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.