diff --git a/src/Database/Barry/Relations/BelongsTo.php b/src/Database/Barry/Relations/BelongsTo.php index 256c3d13..aa1cebd5 100644 --- a/src/Database/Barry/Relations/BelongsTo.php +++ b/src/Database/Barry/Relations/BelongsTo.php @@ -38,7 +38,7 @@ public function __construct( */ public function getResults(): mixed { - $key = $this->query->getTable() . ":belongsto:" . $this->related->getTable() . ":" . $this->foreign_key; + $key = $this->query->getTable() . ":" . $this->local_key . ":belongsto:" . $this->related->getTable() . ":" . $this->foreign_key; $cache = Cache::store('file')->get($key); diff --git a/src/Database/Barry/Relations/HasOne.php b/src/Database/Barry/Relations/HasOne.php index 2639b10e..cb47d921 100644 --- a/src/Database/Barry/Relations/HasOne.php +++ b/src/Database/Barry/Relations/HasOne.php @@ -33,7 +33,7 @@ public function __construct(Model $related, Model $parent, string $foreign_key, */ public function getResults(): ?Model { - $key = $this->query->getTable() . ":hasone:" . $this->related->getTable() . ":" . $this->foreign_key; + $key = $this->query->getTable() . ":" . $this->local_key . ":hasone:" . $this->related->getTable() . ":" . $this->foreign_key; $cache = Cache::store('file')->get($key);