From edcce8d8559d9559c997c177de06eb4bc173956d Mon Sep 17 00:00:00 2001 From: Jonas Staudenmeir Date: Sat, 13 Jul 2024 00:08:11 +0200 Subject: [PATCH] Improve code coverage --- tests/Models/Country.php | 2 +- tests/Models/User.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Models/Country.php b/tests/Models/Country.php index f804ff2..56fc490 100644 --- a/tests/Models/Country.php +++ b/tests/Models/Country.php @@ -59,7 +59,7 @@ public function commentsFromRelationsWithTrashedIntermediateDeepModel(): HasMany public function commentsFromRelationsWithTrashedIntermediateRelatedModel(): HasManyDeep { return $this->hasManyDeepFromRelationsWithConstraints( - [[$this, 'usersWithTrashed'], [new User(), 'comments']] + [[$this, 'usersWithTrashed'], [new User(), 'comment']] ); } diff --git a/tests/Models/User.php b/tests/Models/User.php index 6b3f2c3..41678f6 100644 --- a/tests/Models/User.php +++ b/tests/Models/User.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasManyThrough; +use Illuminate\Database\Eloquent\Relations\HasOneThrough; use Illuminate\Database\Eloquent\SoftDeletes; use Staudenmeir\EloquentHasManyDeep\HasManyDeep; @@ -12,6 +13,11 @@ class User extends Model { use SoftDeletes; + public function comment(): HasOneThrough + { + return $this->hasOneThrough(Comment::class, Post::class); + } + public function comments(): HasManyThrough { return $this->hasManyThrough(Comment::class, Post::class);