Skip to content

Commit

Permalink
#53 Fixed disabling cache (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar authored and barryvdh committed Nov 27, 2018
1 parent 5502468 commit 3906d56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

namespace Barryvdh\HttpCache;

Expand Down Expand Up @@ -28,10 +28,10 @@ class ServiceProvider extends BaseServiceProvider
public function register()
{
$app = $this->app;

$configPath = __DIR__ . '/../config/httpcache.php';
$this->mergeConfigFrom($configPath, 'httpcache');

if (function_exists('config_path')) {
$this->publishes([$configPath => config_path('httpcache.php')], 'config');
}
Expand Down Expand Up @@ -67,6 +67,10 @@ public function boot()
{
$this->app->make(StackMiddleware::class)->bind(CacheRequests::class,
function($app) {
if(! $this->app['config']->get('httpcache.enabled')) {
return $app;
}

return new HttpCache(
$app,
$this->app->make(StoreInterface::class),
Expand Down

0 comments on commit 3906d56

Please sign in to comment.