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
Undefined type 'DB'. Intelphense (1009) in Laravel 6 Controller #945
Comments
@mofizul21 those laravel global namespaced facades like @mstroink that's a strange one. It looks like it has found the definition to provide the hover. Can you share some code that reproduces the issue? |
Closing as original issue has a solution. @mstroink if you are still experiencing this please open a new ticket with a code example. |
Try |
Undefined type 'Database\Seeders\DB' use Illuminate\Support\Facades\DB; |
If you installed the latest version of barryvdh/laravel-ide-helper and you're NOT on Laravel 8, you'll probably need to grab an older version of it. I already had it installed but I was still getting this error message (even tho the code actually works). So I browsed his github and found version 2.8.2 which still supported Laravel prior to version 8 (which is sensible cuz I hate "breaking changes" that cause me to change code). Here's the composer command: |
I was having the same problem. I managed to solve it by correctly adjusting the "namespace" of the class I was calling, as I noticed it wasn't right. I don't know if this is your case, but it doesn't hurt to check. |
I worked !!! thanks bro |
For those who use VSCode with Intelephense, you can try |
like those ahead said and most simply is this with no complexities: use Illuminate\Support\Facades\DB; |
Describe the bug
It's an unexpected error notice when working with Laravel 6 that Undefined type 'DB'.
Expected behavior
It should not display the error notice.
Screenshots
You can see the error notice screenshot here
Platform and version
Windows 10, 64 bit. Intelphsense 1.3.7
The text was updated successfully, but these errors were encountered: