1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bantenprov\Siswa\Models\Bantenprov\Siswa; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
6
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
7
|
|
|
|
8
|
|
|
class Siswa extends Model |
9
|
|
|
{ |
10
|
|
|
use SoftDeletes; |
11
|
|
|
|
12
|
|
|
public $timestamps = true; |
13
|
|
|
|
14
|
|
|
protected $table = 'siswas'; |
15
|
|
|
protected $fillable = [ |
16
|
|
|
'nomor_un', |
17
|
|
|
'nik', |
18
|
|
|
'nama_siswa', |
19
|
|
|
'no_kk', |
20
|
|
|
'alamat_kk', |
21
|
|
|
'province_id', |
22
|
|
|
'city_id', |
23
|
|
|
'district_id', |
24
|
|
|
'village_id', |
25
|
|
|
'tempat_lahir', |
26
|
|
|
'tgl_lahir', |
27
|
|
|
'jenis_kelamin', |
28
|
|
|
'agama', |
29
|
|
|
'nisn', |
30
|
|
|
'tahun_lulus', |
31
|
|
|
'sekolah_id', |
32
|
|
|
'kegiatan_id', |
33
|
|
|
'user_id', |
34
|
|
|
]; |
35
|
|
|
protected $hidden = [ |
36
|
|
|
]; |
37
|
|
|
protected $appends = [ |
38
|
|
|
'label', |
39
|
|
|
]; |
40
|
|
|
protected $dates = [ |
41
|
|
|
'deleted_at', |
42
|
|
|
]; |
43
|
|
|
|
44
|
|
|
public function getLabelAttribute() |
45
|
|
|
{ |
46
|
|
|
return $this->nomor_un.' - '.$this->nama_siswa; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function province() |
50
|
|
|
{ |
51
|
|
|
return $this->belongsTo('Laravolt\Indonesia\Models\Province', 'province_id'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function city() |
55
|
|
|
{ |
56
|
|
|
return $this->belongsTo('Laravolt\Indonesia\Models\City', 'city_id'); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function district() |
60
|
|
|
{ |
61
|
|
|
return $this->belongsTo('Laravolt\Indonesia\Models\District', 'district_id'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function village() |
65
|
|
|
{ |
66
|
|
|
return $this->belongsTo('Laravolt\Indonesia\Models\Village', 'village_id'); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function sekolah() |
70
|
|
|
{ |
71
|
|
|
return $this->belongsTo('Bantenprov\Sekolah\Models\Bantenprov\Sekolah\Sekolah', 'sekolah_id'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function prodi_sekolah() |
75
|
|
|
{ |
76
|
|
|
return $this->belongsTo('Bantenprov\Sekolah\Models\Bantenprov\Sekolah\ProdiSekolah', 'prodi_sekolah_id'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function kegiatan() |
80
|
|
|
{ |
81
|
|
|
return $this->belongsTo('Bantenprov\Kegiatan\Models\Bantenprov\Kegiatan\Kegiatan', 'kegiatan_id'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function user() |
85
|
|
|
{ |
86
|
|
|
return $this->belongsTo('App\User', 'user_id'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function akademik() |
90
|
|
|
{ |
91
|
|
|
return $this->belongsTo('Bantenprov\Nilai\Models\Bantenprov\Nilai\Akademik', 'nomor_un', 'nomor_un'); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function nilai() |
95
|
|
|
{ |
96
|
|
|
return $this->belongsTo('Bantenprov\Nilai\Models\Bantenprov\Nilai\Nilai', 'nomor_un', 'nomor_un'); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|