Skip to content

Conversation

@pataar
Copy link
Contributor

@pataar pataar commented Apr 3, 2025

Summary

(https://laravel-news.com/local-model-scopes-in-laravel-with-the-scope-attribute)

This adds support for the new Scope syntax:

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

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Misc. change (internal, infrastructure, maintenance, etc.)

Checklist

  • Existing tests have been adapted and/or new tests have been added
  • Update the README.md
  • Code style has been fixed via composer fix-style

@pataar pataar changed the title feat(model): add support for the new Scope attribute feat(ModelsCommand): add support for the new Scope attribute Apr 3, 2025
@barryvdh barryvdh merged commit 8eec4f1 into barryvdh:master Apr 4, 2025
32 checks passed
@pataar pataar deleted the add_new_scope_method branch April 24, 2025 07:53
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