Skip to content

Commit 82de600

Browse files
authored
remove unneeded check to make compatible with mongodb
In order for my mongodb models to be able to extend this trait, I had to make a CachedModel of my own as seen below ``` use GeneaLabs\LaravelModelCaching\CachedBuilder as Builder; use GeneaLabs\LaravelModelCaching\Traits\Cachable; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Model; use Jenssegers\Mongodb\Eloquent\Model as Eloquent; abstract class _CachedMongoModel extends Eloquent { use Cachable; ... rest is the same as your CachedModel } ``` But then the above check was a blocker. Upon inspection it seems like there's no reason to make this check since we can assume anyone using your trait is using it with your CachedModel (or an adapted clone as in my case)
1 parent ee14e3d commit 82de600

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Traits/Cachable.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ protected function cache(array $tags = [])
2121
}
2222

2323
if (is_subclass_of($cache->getStore(), TaggableStore::class)) {
24-
if (is_a($this, CachedModel::class)) {
25-
array_push($tags, str_slug(get_called_class()));
26-
}
24+
array_push($tags, str_slug(get_called_class()));
2725

2826
$cache = $cache->tags($tags);
2927
}

0 commit comments

Comments
 (0)