Skip to content

Commit

Permalink
Merge pull request #210 from analogueorm/master
Browse files Browse the repository at this point in the history
Backward compatibility
  • Loading branch information
RemiCollin authored Oct 11, 2017
2 parents cd24cc0 + 10d0d24 commit a838494
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/AnalogueServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Analogue\ORM\System\Manager;
use Illuminate\Contracts\Cache\Repository as CacheRepository;
use Illuminate\Support\ServiceProvider;
use Psr\SimpleCache\CacheInterface;

/**
* Integrate Analogue into Laravel.
Expand Down Expand Up @@ -51,7 +52,11 @@ public function register()
$manager->registerPlugin(\Analogue\ORM\Plugins\Timestamps\TimestampsPlugin::class);
$manager->registerPlugin(\Analogue\ORM\Plugins\SoftDeletes\SoftDeletesPlugin::class);

$manager->setCache($app->make(CacheRepository::class));
// If the cache is pre laravel 5.5, it doesn't implements PSR-16, so we'll skip it.
$cache = $app->make(CacheRepository::class);
if($cache instanceof CacheInterface) {
$manager->setCache($cache);
}

return $manager;
});
Expand Down

0 comments on commit a838494

Please sign in to comment.