From 22b1bfe561022617303f16e03d4148cd995f5370 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Fri, 27 Sep 2024 03:14:09 +0700 Subject: [PATCH] feat: add relationship with model for like --- src/Models/Like.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Models/Like.php b/src/Models/Like.php index 5f5aa7a..2298101 100644 --- a/src/Models/Like.php +++ b/src/Models/Like.php @@ -122,4 +122,14 @@ public function user(): BelongsTo return $this->belongsTo($userModel, $userForeignKey); } + + /** + * Get the model that the like belongs to. + * + * @return BelongsTo + */ + public function model(): BelongsTo + { + return $this->morphTo(); + } }