Skip to content

[Bug]: Local query scopes in a trait don't work when using #[Scope] #1245

@dcaswel

Description

@dcaswel

Bug description

I am working on a project to update all our query scopes to use the new syntax from Laravel 12 to use the #[Scope] Attribute instead of the function naming convention. In our application, we have a number of traits that allow us to share the definition of a relation as well as scopes for that relation. For example, we have a trait called BelongsToComment that has a belongsTo relation to our Comment model as well as a scope called whereBelongsToComment. The problem I'm having is that after regenerating the helper code, it is no longer auto completing the whereBelongsToComment scope. The scopes that are in the actual model without being in a trait do work. Command-clicking on the scope, does take you to the correct place so it's just the auto complete that is having an issue. I did check and this works fine with the old syntax.

Plugin version

11.0.1.252

Operating system

MacOS

Steps to reproduce

Create a trait that has a scope which uses the #[Scope] attribute.
Add that trait to a model
Generate the helper code
Try to use that scope on the model and see that it doesn't come up in the auto complete dropdown

Relevant log output

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions