Skip to content

Commit 7e65ff1

Browse files
authored
Merge pull request #17 from plank/16-nullsafe-caching
Add missing null-safe for cache clearing
2 parents f78da02 + 5233245 commit 7e65ff1

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/Concerns/HasLayouts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static function indexLayout(): Layout
6161
public static function layouts(): Collection
6262
{
6363
if (! static::customizeableLayout()) {
64-
return new Collection();
64+
return new Collection;
6565
}
6666

6767
$layoutModel = static::layoutModel();

src/Exceptions/ContentableException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
use Exception;
66

7-
class ContentableException extends Exception
8-
{
9-
}
7+
class ContentableException extends Exception {}

src/Models/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Content extends Model implements ContentInterface
2121
protected static function boot()
2222
{
2323
static::saved(function (ContentInterface $content) {
24-
$content->contentable->clearCache();
24+
$content->contentable?->clearCache();
2525
});
2626

2727
parent::boot();

0 commit comments

Comments
 (0)