Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk committed May 10, 2024
1 parent ec76c0f commit cfceb89
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/CachesValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ final public function handle($event = null): void

PermanentCacheUpdating::dispatch($this);

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

$value = $this->markValue($value);
$value = $this->addMarkers($value);
}
else {
$value = $this->run($event);
}

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

public function markValue($value): string
public function addMarkers($value): mixed
{
if (
! config('permanent-cache.components.markers.enabled') ||
Expand All @@ -298,6 +301,6 @@ public function markValue($value): string
return $value;
}

return (string) $this->getMarker().$value.$this->getMarker(close: true);
return $this->getMarker().$value.$this->getMarker(close: true);
}
}

0 comments on commit cfceb89

Please sign in to comment.