Completed
Push — master ( 8f332a...9f34da )
by Manel
04:20
created

Enrollment::classroom()   A

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
//use Scool\Foundation\User;
15
16
/**
17
 * Class Enrollment
18
 * @package App\Entities
19
 */
20
class Enrollment extends Model implements Transformable
21
{
22
    //afegim model stateful per als models que volem qeu tinguin estat, com en el name per als noms. Afegir columna state ala migracio de l'objecte(i ens dira com esta l'objecte de la taula(open,closed,etc), es configurable. state amb nullabel si pot ser que no es guarde
23
    use TransformableTrait,Nameable, RecordsActivity;//StatefulTrait;
24
25
    //public $timestamps = false;
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
26
    //all camps
27
    protected $fillable = ['id','name','validated','finished', 'user_id', 'study_id','course_id','classroom_id'];
28
    //TODO: mirar estats (enrollment). Implementar i definir estats(exemple porta(esborrany,valida,feta).
29
    //TODO: Necessari vàlid i no.
30
    //TODO: Afegir rutes minim a un Model.
31
32
    protected $events = [
33
        'created' => EnrollmentCreated::class
34
    ];
35
36
    /**
37
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
38
     */
39
    public function user()
40
    {
41
        return $this->belongsTo(Scool\Foundation\User::class, 'user_id');
42
    }
43
44
    /**
45
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
46
     */
47
    public function classroom()
48
    {
49
        return $this->hasOne("Scool\EnrollmentMobile\Models\Classroom");
50
    }
51
52
    public function course()
53
    {
54
        return $this->hasOne("Scool\EnrollmentMobile\Models\Course");
55
    }
56
57
    public function study()
58
    {
59
        return $this->hasOne("Scool\EnrollmentMobile\Models\Study");
60
    }
61
62
63
//    /**
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...
64
//     * @return \Illuminate\Database\Eloquent\Relations\HasOne
65
//     */
66
//    public function enrollment()
67
//    {
68
//        return $this->hasOne("Scool\EnrollmentMobile\Classroom");
69
//    }
70
}
71