ProdiSekolah   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabelAttribute() 0 8 2
A sekolah() 0 4 1
A program_keahlian() 0 4 1
A user() 0 4 1
1
<?php
2
3
namespace Bantenprov\Sekolah\Models\Bantenprov\Sekolah;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class ProdiSekolah extends Model
9
{
10
    use SoftDeletes;
11
12
    public $timestamps = true;
13
14
    protected $table = 'prodi_sekolahs';
15
    protected $fillable = [
16
        'sekolah_id',
17
        'program_keahlian_id',
18
        'kuota_siswa',
19
        'keterangan',
20
        'user_id',
21
    ];
22
    protected $hidden = [
23
    ];
24
    protected $appends = [
25
        'label',
26
    ];
27
    protected $dates = [
28
        'deleted_at'
29
    ];
30
31
    public function getLabelAttribute()
32
    {
33
        if (isset($this->program_keahlian->label)) {
34
            return $this->program_keahlian->label;
35
        } else {
36
            return 'Keterangan: '.$this->keterangan;
37
        }
38
    }
39
40
    public function sekolah()
41
    {
42
        return $this->belongsTo('Bantenprov\Sekolah\Models\Bantenprov\Sekolah\Sekolah','sekolah_id');
43
    }
44
45
    public function program_keahlian()
46
    {
47
        return $this->belongsTo('Bantenprov\ProgramKeahlian\Models\Bantenprov\ProgramKeahlian\ProgramKeahlian','program_keahlian_id');
48
    }
49
50
    public function user()
51
    {
52
        return $this->belongsTo('App\User','user_id');
53
    }
54
}
55