mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.32k stars 507 forks source link

Issue with routes, either localized routes are not working or new routes. #875

Closed Twyar closed 11 months ago

Twyar commented 11 months ago

Hi,

I've been using this package for a while without any issue. Now idk if I changed anything somewhere in my code, but it seems to be broken for me.

My setup is:

On localhost everything seems to work fine. On Production I'm running in issues however and I can't really seem to debug it properly.

If I run php artisan optimize:clear on production and go to the dashboard. I receive the following error.

Error: Ziggy error: route 'admin.dashboard.index' is not in the route list.

This is a newer route so it doesn't recognize it yet I think. So I tried running php artisan route:trans:cache to cache my routes. Now the dashboard seems to work properly.

However when I try to go to the frontend and go to https://domain.com/nl or https://domain.com/en I get a 404 error.

I tried running php artisan route:trans:list nl and php artisan route:trans:list en and I get a list of the following routes.

GET|HEAD        / ........................................................................................................................................................................... pages.home › PageController@index  
GET|HEAD        _debugbar/assets/javascript ....................................................................................................................... debugbar.assets.js › Barryvdh\Debugbar › AssetController@js  
GET|HEAD        _debugbar/assets/stylesheets .................................................................................................................... debugbar.assets.css › Barryvdh\Debugbar › AssetController@css  
DELETE          _debugbar/cache/{key}/{tags?} .............................................................................................................. debugbar.cache.delete › Barryvdh\Debugbar › CacheController@delete  
GET|HEAD        _debugbar/clockwork/{id} ............................................................................................................. debugbar.clockwork › Barryvdh\Debugbar › OpenHandlerController@clockwork  
GET|HEAD        _debugbar/open ........................................................................................................................ debugbar.openhandler › Barryvdh\Debugbar › OpenHandlerController@handle  
POST            _ignition/execute-solution ...................................................................................................... ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController  
GET|HEAD        _ignition/health-check .................................................................................................................. ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController  
POST            _ignition/update-config ............................................................................................................... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController  
GET|HEAD        admin/dashboard ....................................................................................................................................... admin.dashboard.index › Admin\DashboardController@index  
GET|HEAD        admin/users ................................................................................................................................................. admin.users.index › Admin\UserController@index  
POST            admin/users ................................................................................................................................................. admin.users.store › Admin\UserController@store  
GET|HEAD        admin/users/create ........................................................................................................................................ admin.users.create › Admin\UserController@create  
GET|HEAD        admin/users/{user} ........................................................................................................................................... admin.users.show › Admin\UserController@show  
PUT|PATCH       admin/users/{user} ....................................................................................................................................... admin.users.update › Admin\UserController@update  
DELETE          admin/users/{user} ..................................................................................................................................... admin.users.destroy › Admin\UserController@destroy  

So the routes seem to exist, but I have no clue why they don't seem to work.

Twyar commented 11 months ago

Guess I figured it out.

Had issues with my development server as well where it tried to do a query on a relationship I had a few months ago. Decided to do a simple sudo reboot on the server because it was driving me nuts and apparently that fixed everything.

So my guess it was either a server or nginx cache somewhere.

Edit: It was my Cloudfare caching*, completely forgot that was running on the server.