Skip to content

Scope to use attribute rule #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 22, 2025
Merged

Conversation

peterfox
Copy link
Collaborator

Changes

  • creates the new rule and adds it to the Laravel 12 set.
  • adds tests
  • updates docs

Why

Added in Laravel 12 laravel/framework#54450

 class User extends Model
 {
-    public function scopeActive($query)
+    #[\Illuminate\Database\Eloquent\Attributes\Scope]
+    public function active($query)
     {
         return $query->where('active', 1);
     }
 }

@peterfox peterfox self-assigned this Mar 21, 2025
@GeniJaho GeniJaho merged commit 40bbddd into main Mar 22, 2025
5 checks passed
@GeniJaho GeniJaho deleted the feature/scope-to-use-attribute-rule branch March 22, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants