Code Duplication    Length = 10-10 lines in 2 locations

app/Judite/Models/Student.php 2 locations

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