Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Undefined variable in blade file, but it doesn't even exist anymore

I replaced a blade file with a new file with the same name. Now I get "Undefined variable" error. The variable doesn't exist anymore (also not in the Controller).

I even deleted the file completely to check that I load the correct file. Then I get "file not found" error, so I know it is the correct file.

Why does it still look for the old variables even after I did php artisan cache:clear? Is there anything else I should clear

0 likes
6 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

try php artisan view:clear

Views has a separate cache

2 likes
Ligonsker's avatar

@Sinnbeck Ooo thank you. I was sure that cache:clear is like sufficient and clear the rest as well

Ligonsker's avatar

@Sinnbeck Oh! So this is the one. I was sure cache:clear is the one that does that. thanks!

Snapey's avatar

if you find yourself having to use view clear then you might have a time difference between your local machine and your server. Normally the caching process works perfectly but it relies on timestamps to know that the source file is newer than the cache

1 like
Ligonsker's avatar

@Snapey Good to know. It could very well be it. The did not configure things correctly and everything is a mess there (also a Windows Server)

Please or to participate in this conversation.