F
Filament10mo ago
L!am

Undefined type 'Filament\PanelProvider'.

this project of mine was made with a bit older versions but now i completly updated my versions on my pc the only problem is that now i get this with like every class. I can also not run commands in windows powershell because it will say: Class "Filament\PanelProvider" not found if someone knows how to fix this please let met know
37 Replies
L!am
L!amOP10mo ago
i think the main problem is that the PHP namespaces and middleware classes are no connecting to the class i have been stuck for hours right now i can't find anything on the internet to fix it would love it if someone could help me out
L!am
L!amOP10mo ago
yes, i now work at a company because thats what i need for school and this was an old thing he wanted me to pick up so i think the code still is like v2 compatible and doens't like it that im at v3 and im kinda new to php and filament/ laravel so its pretty hard to understand what things i need to do
toeknee
toeknee10mo ago
So you need to import the panelprovidwe by the looks of it. Just do a scan for code issues and any good ide will pit up on it Give phpStorm a try and it should help you
L!am
L!amOP10mo ago
maybe its a stupid question but how can i do that?
toeknee
toeknee10mo ago
Depends on your IDE In PHP Storm your run inspections see: https://www.jetbrains.com/help/phpstorm/running-inspections.html
L!am
L!amOP10mo ago
so firstly i should download php storm? sorry if i ask so much its all new for me
toeknee
toeknee10mo ago
Only if you want to change your IDE. It's what we use. What are you using now?
L!am
L!amOP10mo ago
i use visual studio code
toeknee
toeknee10mo ago
I am not familiar with VS Code, but make sure you have php intelisense and error checking etc. There will be plugins, you need to find out what file that undeefined type is on and add it
L!am
L!amOP10mo ago
im installing some extensions rn that check errors is there someone in this discord that is fimiliar with VS Code that could help me? and tell me how i exactly need to start with refactoring or changing scripts
toeknee
toeknee10mo ago
Usually you just follow the docs for v2->v3 But you will get bugs and the above is a bug you are calling the panel provider without defining it.
L!am
L!amOP10mo ago
oh oke yeah its just very weird because on a other computer everything works but ill try to figure something out probably not gonna happen 🤣 to much things for me first time using php
toeknee
toeknee10mo ago
You have run composer install right?
L!am
L!amOP10mo ago
yes
L!am
L!amOP10mo ago
just did it again and i get this
No description
Vp
Vp10mo ago
Read Problem 1 second - it's clearly said that you need intl
L!am
L!amOP10mo ago
now i get this
No description
L!am
L!amOP10mo ago
what do i do now?
Saade
Saade10mo ago
Your class has a wrong namespace App\Filament\Resources\FlowResource.... it should be App\Filament\Resources\FlowTemplateResource according to your folder structure
Saade
Saade10mo ago
These two extensions should be enough to show you the errors. You can "ctrl+shiift+p" and "Generate namespace"
No description
L!am
L!amOP10mo ago
in my HasComponents.php script right? ugh i have exactly no idea what to do
Dennis Koch
Dennis Koch10mo ago
Your class namespace does not match your folder structure. The PSR-4 autoloader requires them to be the same. Therefore it cannot find your class.
L!am
L!amOP10mo ago
this is my autoload in composer.json and this is my path to the project C:\Software\3p_manager_code
No description
Dennis Koch
Dennis Koch10mo ago
That's unrelated. Check you folder name vs. your class name As Saade already pointed out
L!am
L!amOP10mo ago
ohh i get it
L!am
L!amOP10mo ago
these scripts have to match
No description
L!am
L!amOP10mo ago
these
No description
Dennis Koch
Dennis Koch10mo ago
Those are the same files. Just in different apps.
Dennis Koch
Dennis Koch10mo ago
The namespace at the top of the PHP file must match the file and folder names.
No description
L!am
L!amOP10mo ago
maybe i sound really dumb but if my script is named hello.php the namespace should be App\Filament\hello; ?
L!am
L!amOP10mo ago
or is this good?
No description
Dennis Koch
Dennis Koch10mo ago
In your composer.json you map the folder app/ to App. After that everything is the next folder. So the namespace App/Filament/Pages and class YourPage translates to folder app/Filament/Pages and the File YourPage.php For this one file it's good. I can't say anything about the other files.
L!am
L!amOP10mo ago
oke but thats how it needs to be done everything is in the map app so i start with App\map it is in then Providers\ and then FIlament or Enums now i understand it
Dennis Koch
Dennis Koch10mo ago
Here are more examples and the specification: https://www.php-fig.org/psr/psr-4/#3-examples
PSR-4: Autoloader - PHP-FIG
We're a group of established PHP projects whose goal is to talk about commonalities between our projects and find ways we can work better together.
L!am
L!amOP10mo ago
thanks for helping with that 😄 on to the next problem 🤣 the next problem Syntax error: unexpected token 'EmploymentContractEnum' 🙈
Saade
Saade10mo ago
I may sound harsh but, did you really know what you’re doing? Like, you said “this project of mine was made with a bit old version” did you really made that project? Otherwise you would know how to solve these problems. Don’t get me wrong, it’s completely ok to ask questions here, but these problems are PHP fundamentals ones, like syntax errors and class namespaces….
Want results from more Discord servers?
Add your server