Skip to content

Commit cfceb89

Browse files
committed
wip
1 parent ec76c0f commit cfceb89

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/CachesValue.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,14 @@ final public function handle($event = null): void
6565

6666
PermanentCacheUpdating::dispatch($this);
6767

68-
$value = is_subclass_of(static::class, CachedComponent::class)
69-
? Blade::renderComponent($this)
70-
: $this->run($event);
68+
if(is_subclass_of(static::class, CachedComponent::class)) {
69+
$value = Blade::renderComponent($this);
7170

72-
$value = $this->markValue($value);
71+
$value = $this->addMarkers($value);
72+
}
73+
else {
74+
$value = $this->run($event);
75+
}
7376

7477
Cache::driver($driver)->forever($cacheKey, (object) [
7578
'value' => $value,
@@ -289,7 +292,7 @@ public function getMarker(array $parameters = [], $close = false): string
289292
return '<!--'.($close ? '/' : '').$marker.'-->';
290293
}
291294

292-
public function markValue($value): string
295+
public function addMarkers($value): mixed
293296
{
294297
if (
295298
! config('permanent-cache.components.markers.enabled') ||
@@ -298,6 +301,6 @@ public function markValue($value): string
298301
return $value;
299302
}
300303

301-
return (string) $this->getMarker().$value.$this->getMarker(close: true);
304+
return $this->getMarker().$value.$this->getMarker(close: true);
302305
}
303306
}

0 commit comments

Comments
 (0)