Skip to content

Commit 3906d56

Browse files
Andrey Helldarbarryvdh
authored andcommitted
#53 Fixed disabling cache (#54)
1 parent 5502468 commit 3906d56

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ServiceProvider.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php
22

33
namespace Barryvdh\HttpCache;
44

@@ -28,10 +28,10 @@ class ServiceProvider extends BaseServiceProvider
2828
public function register()
2929
{
3030
$app = $this->app;
31-
31+
3232
$configPath = __DIR__ . '/../config/httpcache.php';
3333
$this->mergeConfigFrom($configPath, 'httpcache');
34-
34+
3535
if (function_exists('config_path')) {
3636
$this->publishes([$configPath => config_path('httpcache.php')], 'config');
3737
}
@@ -67,6 +67,10 @@ public function boot()
6767
{
6868
$this->app->make(StackMiddleware::class)->bind(CacheRequests::class,
6969
function($app) {
70+
if(! $this->app['config']->get('httpcache.enabled')) {
71+
return $app;
72+
}
73+
7074
return new HttpCache(
7175
$app,
7276
$this->app->make(StoreInterface::class),

0 commit comments

Comments
 (0)