diff --git a/app/Models/User.php b/app/Models/User.php index 30e32061ed..339f15d036 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -481,8 +481,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo /** * Establishes the user -> uploads relationship * - * @todo I don't think we use this? - * * @author A. Gianotto * @since [v3.0] * @return \Illuminate\Database\Eloquent\Relations\Relation @@ -496,6 +494,21 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo ->orderBy('created_at', 'desc'); } + /** + * Establishes the user -> acceptances relationship + * + * @author A. Gianotto + * @since [v3.0] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function acceptances() + { + return $this->hasMany(\App\Models\Actionlog::class, 'target_id') + ->where('target_type', self::class) + ->where('action_type', '=', 'accepted') + ->orderBy('created_at', 'desc'); + } + /** * Establishes the user -> requested assets relationship *