Skip to content

Commit

Permalink
feat: add relationship with model for like
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Sep 26, 2024
1 parent c3506a3 commit 22b1bfe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Models/Like.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,14 @@ public function user(): BelongsTo

return $this->belongsTo($userModel, $userForeignKey);
}

/**
* Get the model that the like belongs to.
*
* @return BelongsTo<Model, self>
*/
public function model(): BelongsTo
{
return $this->morphTo();
}
}

0 comments on commit 22b1bfe

Please sign in to comment.