Skip to content

Commit 69d6eb5

Browse files
committed
Ignore non-cachable related models
Fixes #255
1 parent e0971ae commit 69d6eb5

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/Traits/Caching.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ protected function checkCooldownAndFlushAfterPersisting(Model $instance, string
186186
$instance->flushCache();
187187

188188
if ($relationship) {
189-
$instance->$relationship()->getModel()->flushCache();
189+
$relationshipInstance = $instance->$relationship()->getModel();
190+
191+
if (method_exists($instance, "flushCache")) {
192+
$relationshipInstance->flushCache();
193+
}
190194
}
191195

192196
return;

tests/database/baseline.sqlite

-8 KB
Binary file not shown.

tests/database/testing.sqlite

-8 KB
Binary file not shown.

0 commit comments

Comments
 (0)