To clear cache in laravel login to terminal using ssh and cd too larvel root directory. this tutorial will help you to clear your cache and which cache will removed.

1. Clear Application cache

    To clear application cache run following command
    php artisan cace:clear

2. Clear Route cache

    To clear route cache run following command
    php artisan route:clear

3. Clear Config cache

    To clear configuration cache run following command
    php artisan config:clear

4. Clear View file cache

    To clear views cache run following command
    php artisan view:clear

If you want to clear all cache in one command then make one artisan command for your self then run it. For example

    php artisan clear:all

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class ClearAll extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'clear:all';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Clear all laravel cache';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        \Artisan::call('cache:clear');
        $this->info('Application cache is cleared.');
        \Artisan::call('config:clear');
        $this->info('Configuration cache is cleared.');        
        \Artisan::call('route:clear');
        $this->info('Route cache is cleared.');
        \Artisan::call('view:clear');
        $this->info('View cache is cleared.');
    }
}

 

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.