Code Duplication    Length = 23-23 lines in 2 locations

src/Notifynder/Traits/Notifable.php 1 location

@@ 8-30 (lines=23) @@
5
/**
6
 * Class Notifable.
7
 */
8
trait Notifable
9
{
10
    use NotifableBasic;
11
    /**
12
     * Get the notifications Relationship.
13
     *
14
     * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany
15
     */
16
    public function notifications()
17
    {
18
        $model = notifynder_config()->getNotificationModel();
19
        if (notifynder_config()->isPolymorphic()) {
20
            return $this->morphMany($model, 'to');
21
        }
22
23
        return $this->hasMany($model, 'to_id');
24
    }
25
26
    public function getNotificationRelation()
27
    {
28
        return $this->notifications();
29
    }
30
}
31

src/Notifynder/Traits/NotifableLaravel53.php 1 location

@@ 8-30 (lines=23) @@
5
/**
6
 * Class Notifable.
7
 */
8
trait NotifableLaravel53
9
{
10
    use NotifableBasic;
11
    /**
12
     * Get the notifications Relationship.
13
     *
14
     * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany
15
     */
16
    public function notifynderNotifications()
17
    {
18
        $model = notifynder_config()->getNotificationModel();
19
        if (notifynder_config()->isPolymorphic()) {
20
            return $this->morphMany($model, 'to');
21
        }
22
23
        return $this->hasMany($model, 'to_id');
24
    }
25
26
    public function getNotificationRelation()
27
    {
28
        return $this->notifynderNotifications();
29
    }
30
}
31