barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.21k stars 1.16k forks source link

Non-static method 'where'... after update Laravel and Ide-helper #1191

Open morawcik opened 3 years ago

morawcik commented 3 years ago

Hi, today after updated Laravel from 8.31.0 to 8.33.1 and Ide-helper from 2.9.0 to 2.9.1 (by composer update) and running all commands (eloquent, generate, meta and models --write-mixin) i'm getting error

Non-static method 'where' should not be called statically, but the class has the '__magic' method.

for User::where('email', $email)->first()

mfn commented 3 years ago

Can you provide a repository for easily reproducing this? and can you provide the exact command you used there?

Ideally something like:

morawcik commented 3 years ago

Ok. I created fresh install (couple of times to check it) https://github.com/morawcik/test-laravel-ide-helper and it seams that sth with ide-generate:eloquent. My steps:

mfn commented 3 years ago

Ok I see, I think I initially missed the you use ide-helper:eloquent. IMHO that's quite a bastard comment and should be avoided, as it modifies your vendor files 😢

However, cloning your project I still don't know where I should get this

Non-static method 'where' should not be called statically, but the class has the '__magic' method

I can confirm the CDM-click gives 2 options to me now: image

But this is expected in this setup I would say 🤷‍♀️

Trying to avoid writing the meta data of the models to them brings all this weird issues it seems to me.

RyanPaiva56 commented 2 years ago

I'm also getting this issue when using --write-mixin. Is there a solution?

iwasherefirst2 commented 1 year ago

I get this issue aswell. Have it on all my Eloquent models when calling create or so:

image