Passed
Push — develop ( dbe277...ea1e27 )
by Francisco
02:33
created

LogExchange::course()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Judite\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class LogExchange extends Model
8
{
9
    /**
10
     * Get source shift of this logged exchange.
11
     *
12
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
13
     */
14
    public function fromShift()
15
    {
16
        return $this->belongsTo(Shift::class, 'from_shift_id');
17
    }
18
19
    /**
20
     * Get target shift of this logged exchange.
21
     *
22
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
23
     */
24
    public function toShift()
25
    {
26
        return $this->belongsTo(Shift::class, 'to_shift_id');
27
    }
28
29
    /**
30
     * Get source student of this logged exchange.
31
     *
32
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
33
     */
34
    public function fromStudent()
35
    {
36
        return $this->belongsTo(Student::class, 'from_student_id');
37
    }
38
39
    /**
40
     * Get target student of this logged exchange.
41
     *
42
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
43
     */
44
    public function toStudent()
45
    {
46
        return $this->belongsTo(Student::class, 'to_student_id');
47
    }
48
49
    /**
50
     * Get course of this logged exchange.
51
     *
52
     * @return \App\Judite\Models\Course
53
     */
54
    public function course()
55
    {
56
        return $this->toShift->course;
57
    }
58
}
59