diff --git a/src/Moderatable.php b/src/Moderatable.php index a4bd65f..3a561a6 100644 --- a/src/Moderatable.php +++ b/src/Moderatable.php @@ -2,8 +2,6 @@ namespace Hootlex\Moderation; - - trait Moderatable { use ModerationQueryBuilder; @@ -207,4 +205,14 @@ public function getModeratedByColumn() public function getDates(){ return array_merge(parent::getDates(), [$this->getModeratedAtColumn()]); } + + /** + * Defines the inverse relationship towards this "moderated_by" Eloquent User. + * + * @return string + */ + public function moderator() + { + return $this->belongsTo(config('auth.providers.users.model'), $this->getModeratedByColumn()); + } }