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

nara014's avatar

laravel route was not detected after enabling php artisan optimize

hello, I want to report anomalies when using laravel, actually this happened in version 5 too.

So, when I finish installing laravel. i am trying to use artisan optimize php to try cleaning. Then I tried to write a route, it worked fine at first .. then when I edited this route, a problem occurred. At first I created this route with the GET method, then when I changed POST it didn't change automatically. but when I clear route cache its okay. What happened exactly?

this code and php artisan route:list --name="change-lang" before i change to POST method Screenshot from 2020-09-24 23-52-01 Screenshot from 2020-09-24 23-59-43

this code and php artisan route:list --name="change-lang" after i change to POST method Screenshot from 2020-09-25 00-01-36 nothing changes. I know with just a php artisan route: this cache can return to normal, but if it's not automatic it will make this even more difficult. so how to fix this? thank u

0 likes
2 replies
Sinnbeck's avatar

Optimize caches everything including routes. Never run it, or any cache commands on your development computer

Run php artisan optimize:clear to remove the caching again

1 like

Please or to participate in this conversation.