Skip to content

Commit

Permalink
fix: use unique cache key per panel
Browse files Browse the repository at this point in the history
  • Loading branch information
JaZo committed Jan 29, 2024
1 parent 9d57410 commit fa7cc68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to `swisnl/filament-backgrounds` will be documented in this file.

## Unreleased

### Fixed

* Use unique cache key per panel (#8).

## 1.1.1 - 2023-12-13

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions src/FilamentBackgroundsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

class FilamentBackgroundsPlugin implements Plugin
{
protected Panel $panel;

protected ProvidesImages $imageProvider;

protected \DateInterval | \DateTimeInterface | int $ttl = 0;
Expand All @@ -39,7 +41,7 @@ public static function get(): static

public function register(Panel $panel): void
{
//
$this->panel = $panel;
}

public function boot(Panel $panel): void
Expand Down Expand Up @@ -86,7 +88,7 @@ protected function getCssVariables(): array
protected function getImage(): Image
{
return Cache::remember(
'filament-backgrounds:image',
'filament-backgrounds:image:' . $this->panel->getId(),
$this->ttl,
fn () => ($this->imageProvider ?? CuratedBySwis::make())->getImage()
);
Expand Down

0 comments on commit fa7cc68

Please sign in to comment.