Kelasrawat::kelas()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php namespace Bantenprov\YankesInfoKamar\Models;
2
3
use Illuminate\Database\Eloquent\Model;
4
use Illuminate\Database\Eloquent\SoftDeletes;
5
6
/**
7
 * The InfoKamarModel class.
8
 *
9
 * @package Supriyanih\InfoKamar
10
 * @author  supriyanih <[email protected]>
11
 */
12
class Kelasrawat extends Model
13
{
14
    /**
15
    * Table name.
16
    *
17
    * @var string
18
    */
19
    use SoftDeletes;
20
    protected $table = 'kelas_rawat_inap';
21
22
    /**
23
    * The attributes that are mass assignable.
24
    *
25
    * @var mixed
26
    */
27
    protected $fillable = ['kode_kelas','nama_kelas'];
28
29
    /**
30
     * The attributes that should be hidden for arrays.
31
     *
32
     * @var array
33
     */
34
    protected $hidden = ['deleted_at'];
35
36
    protected static function boot()
37
        {
38
          parent::boot();
39
40
          static::deleting(function($kelas_rawat_inap) {
41
             foreach ($kelas_rawat_inap->kelas()->get() as $kls) {
42
                $kls->delete();
43
             }
44
          });
45
        }
46
47
     public function kelas()
48
    {
49
      return  $this->hasMany('Bantenprov\YankesInfoKamar\Models\Ruangrawat','id');
50
    }
51
}
52