laravel config cache code example

Example 1: config clear laravel

php artisan config:clear

Example 2: laravel disable config cache

php artisan cache:clear - Flush the application cache

php artisan config:cache - Create a cache file for faster configuration loading. This is for configuration cache. This command will clear the configuration cache before it creates. More details

php artisan config:clear - Remove the configuration cache file

Example 3: laravel fix cache

php artisan cache:clear

Example 4: laravel APP_ENV config

if (\Illuminate\Support\Facades\App::environment('production')) {
    // The environment is production
}

Example 5: laravel cache

Cache::put('key', 'value', $seconds);
Cache::rememberForever('users', function () {
    return DB::table('users')->get();
}); 
Cache::get('key');
Cache::has('key');
Cache::pull('key');