Enrollment::classroom()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Scool\EnrollmentMobile\Models;
4
5
use Acacha\Names\Traits\Nameable;
6
7
use Acacha\Stateful\Traits\StatefulTrait;
8
use Manelgavalda\EnrollmentMobileTest\User;
9
use Scool\EnrollmentMobile\Events\EnrollmentCreated;
10
use Scool\EnrollmentMobile\Traits\RecordsActivity;
11
use Illuminate\Database\Eloquent\Model;
12
use Prettus\Repository\Contracts\Transformable;
13
use Prettus\Repository\Traits\TransformableTrait;
14
15
//use Scool\Foundation\User;
16
17
/**
18
 * Class Enrollment
19
 * @package App\Entities
20
 */
21
class Enrollment extends Model implements Transformable
22
{
23
    use TransformableTrait,Nameable, RecordsActivity; // StatefulTrait;
24
25
26
    protected $fillable = ['id','name','validated','finished', 'user_id', 'study_id','course_id','classroom_id'];
27
28
    protected $states = [
29
        'User' => ['initial' => true],
30
        'Enrollments',
31
        'Study',
32
        'Module',
33
        'Active',
34
        'Submodule' => ['final' => true]
35
    ];
36
37
    protected $transitions = [
38
        'create' => [
39
            'from' => 'User',
40
            'to' => 'Enrollments'
41
        ],
42
        'chose_enrollment' => [
43
            'from' => 'Enrollments',
44
            'to' => 'Study'
45
        ],
46
        'chose_module' => [
47
            'from' => 'Study',
48
            'to' => 'Module'
49
        ],
50
        'chose_submodules' => [
51
            'from' => 'Module',
52
            'to' => 'Submodule'
53
        ],
54
        'enrollment_status' => [
55
            'from' => 'Submodule',
56
            'to' => 'Active'
57
        ]
58
    ];
59
60
    protected $events = [
61
        'created' => EnrollmentCreated::class
62
    ];
63
64
    /**
65
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
66
     */
67
    public function user()
68
    {
69
        return $this->belongsTo(Scool\Foundation\User::class, 'user_id');
70
    }
71
72
    /**
73
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
74
     */
75
    public function classroom()
76
    {
77
        return $this->hasOne("Scool\EnrollmentMobile\Models\Classroom");
78
    }
79
80
    public function course()
81
    {
82
        return $this->hasOne("Scool\EnrollmentMobile\Models\Course");
83
    }
84
85
    public function study()
86
    {
87
        return $this->hasOne("Scool\EnrollmentMobile\Models\Study");
88
    }
89
90
91
//    /**
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
92
//     * @return \Illuminate\Database\Eloquent\Relations\HasOne
93
//     */
94
//    public function enrollment()
95
//    {
96
//        return $this->hasOne("Scool\EnrollmentMobile\Classroom");
97
//    }
98
}
99