Skip to content

Commit c2a9005

Browse files
authored
Merge pull request #156 from nope7777/lumen-support
Lumen support
2 parents d4b289b + 5e29a9e commit c2a9005

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Console/Commands/Clear.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function handle()
2121

2222
protected function flushEntireCache() : int
2323
{
24-
cache()
24+
app('cache')
2525
->store(config('laravel-model-caching.store'))
2626
->flush();
2727

src/Traits/Caching.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait Caching
1313

1414
public function cache(array $tags = [])
1515
{
16-
$cache = cache();
16+
$cache = app('cache');
1717

1818
if (config('laravel-model-caching.store')) {
1919
$cache = $cache->store(config('laravel-model-caching.store'));
@@ -70,7 +70,7 @@ protected function makeCacheKey(
7070
) : string {
7171
$eagerLoad = $this->eagerLoad ?? [];
7272
$model = $this->model ?? $this;
73-
$query = $this->query ?? app(Builder::class);
73+
$query = $this->query ?? app('db')->query();
7474

7575
return (new CacheKey($eagerLoad, $model, $query))
7676
->make($columns, $idColumn, $keyDifferentiator);
@@ -80,7 +80,7 @@ protected function makeCacheTags() : array
8080
{
8181
$eagerLoad = $this->eagerLoad ?? [];
8282
$model = $this->model ?? $this;
83-
$query = $this->query ?? app(Builder::class);
83+
$query = $this->query ?? app('db')->query();
8484

8585
$tags = (new CacheTags($eagerLoad, $model, $query))
8686
->make();

tests/CreatesApplication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait CreatesApplication
1414

1515
protected function cache()
1616
{
17-
$cache = cache();
17+
$cache = app('cache');
1818

1919
if (config('laravel-model-caching.store')) {
2020
$cache = $cache->store(config('laravel-model-caching.store'));
@@ -33,7 +33,7 @@ public function setUp()
3333
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
3434
view()->addLocation(__DIR__ . '/resources/views', 'laravel-model-caching');
3535

36-
$this->cache = cache()
36+
$this->cache = app('cache')
3737
->store(config('laravel-model-caching.store'));
3838

3939
$this->cache()->flush();

tests/Integration/Traits/CachableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public function testSpecifyingAlternateCacheDriver()
2929

3030
$authors = (new Author)
3131
->all();
32-
$defaultcacheResults = cache()
32+
$defaultcacheResults = app('cache')
3333
->tags($tags)
3434
->get($key)['value'];
35-
$customCacheResults = cache()
35+
$customCacheResults = app('cache')
3636
->store('customCache')
3737
->tags($tags)
3838
->get($key)['value'];

0 commit comments

Comments
 (0)