How to clear Route Caching on server: Laravel 5.2.37

后端 未结 4 721
春和景丽
春和景丽 2020-12-08 02:09

This is regarding route cache on localhost

About Localhost

I have 2 routes in my route.php file. Both are working fine. No problem in that. I was learning

相关标签:
4条回答
  • 2020-12-08 02:40

    If you want to remove the routes cache on your server, remove this file:

    bootstrap/cache/routes.php

    And if you want to update it just run php artisan route:cache and upload the bootstrap/cache/routes.php to your server.

    0 讨论(0)
  • 2020-12-08 02:51

    you can define a route in web.php

    Route::get('/clear/route', 'ConfigController@clearRoute');
    

    and make ConfigController.php like this

       class ConfigController extends Controller
    {
        public function clearRoute()
        {
            \Artisan::call('route:clear');
        }
    }
    

    and go to that route on server example http://your-domain/clear/route

    0 讨论(0)
  • 2020-12-08 03:00

    If you are uploading your files through GIT from your local machine then you can use the same command you are using in your local machine while you are connected to your live server using BASH or something like.You can use this as like you use locally.

    php artisan cache:clear
    
    php artisan route:cache
    

    It should work.

    0 讨论(0)
  • 2020-12-08 03:02

    For your case solution is :

    php artisan cache:clear
    php artisan route:cache
    

    Optimizing Route Loading is a must on production :

    If you are building a large application with many routes, you should make sure that you are running the route:cache Artisan command during your deployment process:

    php artisan route:cache
    

    This command reduces all of your route registrations into a single method call within a cached file, improving the performance of route registration when registering hundreds of routes.

    Since this feature uses PHP serialization, you may only cache the routes for applications that exclusively use controller based routes. PHP is not able to serialize Closures.

    Laravel 5 clear cache from route, view, config and all cache data from application

    I would like to share my experience and solution. when i was working on my laravel e commerce website with gitlab. I was fetching one issue suddenly my view cache with error during development. i did try lot to refresh and something other but i can't see any more change in my view, but at last I did resolve my problem using laravel command so, let's see i added several command for clear cache from view, route, config etc.

    Reoptimized class loader:

    php artisan optimize
    

    Clear Cache facade value:

    php artisan cache:clear
    

    Clear Route cache:

    php artisan route:cache
    

    Clear View cache:

    php artisan view:clear
    

    Clear Config cache:

    php artisan config:cache
    
    0 讨论(0)
提交回复
热议问题