From e968ee22c2dedc0c85b5ceed6cb0e752dc30fb59 Mon Sep 17 00:00:00 2001 From: MHortulanus Date: Mon, 3 Jun 2024 14:00:10 +0200 Subject: [PATCH] wip --- src/CachesValue.php | 10 ++++++++-- src/Routes/web.php | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/CachesValue.php b/src/CachesValue.php index 2d3468d..d597b20 100644 --- a/src/CachesValue.php +++ b/src/CachesValue.php @@ -314,7 +314,13 @@ public function addMarkers($value): mixed public function getRefreshRoute() { - $class = (new ReflectionClass($this))->name;; - return route('permanent-cache.update', encrypt([$class])); + $class = get_class($this); + $props = + collect((new ReflectionClass($this))->getProperties(\ReflectionProperty::IS_PUBLIC)) + ->where('class', __CLASS__) + ->mapWithKeys(fn ($prop) => [$prop->name => $this->{$prop->name}]) + ->toArray(); + + return route('permanent-cache.update', ['data' => encrypt([$class, $props])]); } } diff --git a/src/Routes/web.php b/src/Routes/web.php index e332e3a..a435750 100644 --- a/src/Routes/web.php +++ b/src/Routes/web.php @@ -9,5 +9,7 @@ $class = new \ReflectionClass($class); $staticClass = $class->getName(); - return response($staticClass::updateAndGet(), 200, []); + $staticClass::update(); + + return \Illuminate\Support\Facades\Blade::renderComponent(app()->make($class, $props)); })->name('permanent-cache.update');