Laravel-ide-helper: Why are scope-methods declared static?

Created on 29 Jan 2016  路  5Comments  路  Source: barryvdh/laravel-ide-helper

In my code I have scope-methodes, like public function scopeActive($query, $value = true). However, after running models I get this line: * @method static \Illuminate\Database\Query\Builder|\Storesquare\Product active($value = true)

Why has it suddenly become static? PHPStorm now complains that I should call ::active() instead of ->active() on my model.

image

stale

Most helpful comment

I'm not sure anymore, but I think I meant: could an @method line also be created for ->active() instead of just ::active()?

All 5 comments

Because you can also call like MyModel::active()

I'm not sure anymore, but I think I meant: could an @method line also be created for ->active() instead of just ::active()?

any news about this one? @Lambik @barryvdh

If I'll write in Model scope
@method \Illuminate\Database\Eloquent\Builder|\App\Room byLocation(\App\Models\Locations\CommonLocation $location)
then scopeByLocation works without static calling

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

Was this page helpful?
0 / 5 - 0 ratings