Code Duplication    Length = 10-10 lines in 2 locations

app/Judite/Models/Student.php 2 locations

@@ 41-50 (lines=10) @@
38
     *
39
     * @return \Illuminate\Database\Eloquent\Builder
40
     */
41
    public function requestedExchanges()
42
    {
43
        $enrollmentsRelationship = $this->enrollments();
44
        $enrollmentsKeyName = $enrollmentsRelationship->getRelated()->getKeyName();
45
        $enrollmentsIdsQuery = $enrollmentsRelationship
46
            ->select($enrollmentsKeyName)
47
            ->getBaseQuery();
48
49
        return Exchange::whereFromEnrollmentIn($enrollmentsIdsQuery);
50
    }
51
52
    /**
53
     * Get exchanges proposed to this student.
@@ 57-66 (lines=10) @@
54
     *
55
     * @return \Illuminate\Database\Eloquent\Builder
56
     */
57
    public function proposedExchanges()
58
    {
59
        $enrollmentsRelationship = $this->enrollments();
60
        $enrollmentsKeyName = $enrollmentsRelationship->getRelated()->getKeyName();
61
        $enrollmentsIdsQuery = $enrollmentsRelationship
62
            ->select($enrollmentsKeyName)
63
            ->getBaseQuery();
64
65
        return Exchange::whereToEnrollmentIn($enrollmentsIdsQuery);
66
    }
67
68
    /**
69
     * Get enrollments of this student.