From 6bf56f021345c30b374520814bd7862b8f5c28c3 Mon Sep 17 00:00:00 2001 From: Chris Morrell Date: Mon, 15 Sep 2025 16:05:33 -0400 Subject: [PATCH] Rename attribute-related methods to be more explicit --- src/EloquentBacking.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EloquentBacking.php b/src/EloquentBacking.php index 80845a8..fa272c5 100644 --- a/src/EloquentBacking.php +++ b/src/EloquentBacking.php @@ -128,7 +128,7 @@ public function get(): Model public function fresh(): Model { $model = static::model()->newQuery() - ->where($this->attributes()) + ->where($this->eloquentIdentityAttributes()) ->firstOr(fn() => $this->createMissing()); // This ensures that if this specific model is updated or deleted, @@ -171,7 +171,7 @@ protected function createMissing(): Model return static::model()->newQuery()->create($this->attributesForCreation()); } - protected function attributes(): array + protected function eloquentIdentityAttributes(): array { return [ static::getKeyColumn() => static::valueToAttribute($this->value), @@ -181,13 +181,13 @@ protected function attributes(): array protected function attributesForCreation(): array { return array_merge( - $this->attributes(), - $this->values(), + $this->eloquentIdentityAttributes(), + $this->eloquentAdditionalAttributes(), $this->createWith(), ); } - protected function values(): array + protected function eloquentAdditionalAttributes(): array { return Arr::except(ValueHelper::getValuesFor($this), [static::getKeyColumn()]); }