Commit a5d6c5c4 by Triyah Fatmawati

Perbaikan model

parent e9205cf9
...@@ -11,7 +11,22 @@ class Agenda extends Model ...@@ -11,7 +11,22 @@ class Agenda extends Model
protected $table = 'ms_agenda'; protected $table = 'ms_agenda';
protected $fillable = [ protected $fillable = [
'id', 'nama', 'tanggal', 'waktu_mulai', 'waktu_selesai', 'lokasi', 'statusacara', 'idunit', 'idkategori', 'linkzoom', 'idattachment', 'created_at', 'updated_at', 'deleted_at', 'userid_created', 'userid_updated' 'id',
'nama',
'tanggal',
'waktu_mulai',
'waktu_selesai',
'lokasi',
'statusacara',
'idunit',
'idkategori',
'linkzoom',
'idattachment',
'created_at',
'updated_at',
'deleted_at',
'userid_created',
'userid_updated'
]; ];
// public function rUserAgenda() // public function rUserAgenda()
...@@ -21,7 +36,7 @@ class Agenda extends Model ...@@ -21,7 +36,7 @@ class Agenda extends Model
public function rUnit() public function rUnit()
{ {
return $this->hasOne(Unit::class, 'idunit', 'id'); return $this->belongsTo(Unit::class, 'idunit', 'id');
} }
public function rKategori() public function rKategori()
......
...@@ -11,16 +11,21 @@ class Attachment extends Model ...@@ -11,16 +11,21 @@ class Attachment extends Model
protected $table = 'ms_attachment'; protected $table = 'ms_attachment';
protected $fillable = [ protected $fillable = [
'id', 'nama', 'id_kategori_dokumen', 'updated_at', 'created_at', 'deleted_at', 'id',
'nama',
'id_kategori_dokumen',
'updated_at',
'created_at',
'deleted_at',
]; ];
public function rAgenda() public function rAgenda()
{ {
return $this->hasOne(Agenda::class, 'id', 'idattachment'); return $this->belongsTo(Agenda::class, 'idattachment', 'id');
} }
public function rKategoriDokumen() public function rKategoriDokumen()
{ {
return $this->hasOne(KategoriDokumen::class, 'id_kategori_dokumen', 'id'); return $this->hasOne(KategoriDokumen::class, 'id_kategori_dokumen', 'id');
} }
} }
...@@ -11,11 +11,15 @@ class Kategori extends Model ...@@ -11,11 +11,15 @@ class Kategori extends Model
protected $table = 'ms_kategori'; protected $table = 'ms_kategori';
protected $fillable = [ protected $fillable = [
'id', 'nama','created_at', 'updated_at', 'deleted_at', 'id',
'nama',
'created_at',
'updated_at',
'deleted_at',
]; ];
public function rAgenda() public function rAgenda()
{ {
return $this->hasMany(Agenda::class, 'id', 'idkategori'); return $this->belongsToMany(Agenda::class, 'idkategori', 'id');
} }
} }
...@@ -11,11 +11,15 @@ class KategoriDokumen extends Model ...@@ -11,11 +11,15 @@ class KategoriDokumen extends Model
protected $table = 'ms_kategori_attachment'; protected $table = 'ms_kategori_attachment';
protected $fillable = [ protected $fillable = [
'id', 'nama','created_at', 'updated_at', 'deleted_at', 'id',
'nama',
'created_at',
'updated_at',
'deleted_at',
]; ];
public function rAttachment() public function rAttachment()
{ {
return $this->hasMany(Attachment::class, 'id', 'id_kategori_dokumen'); return $this->belongsToMany(Attachment::class, 'id_kategori_dokumen', 'id');
} }
} }
...@@ -11,7 +11,14 @@ class Pegawai extends Model ...@@ -11,7 +11,14 @@ class Pegawai extends Model
protected $table = 'pegawai'; protected $table = 'pegawai';
protected $fillable = [ protected $fillable = [
'id', 'nama', 'nip', 'idunit', 'statusaktif', 'created_at', 'updated_at', 'deleted_at', 'id',
'nama',
'nip',
'idunit',
'statusaktif',
'created_at',
'updated_at',
'deleted_at',
]; ];
// public function rUserAgenda() // public function rUserAgenda()
...@@ -21,12 +28,12 @@ class Pegawai extends Model ...@@ -21,12 +28,12 @@ class Pegawai extends Model
public function rUnit() public function rUnit()
{ {
return $this->hasOne(Unit::class, 'idunit', 'id'); return $this->belongsTo(Unit::class, 'idunit', 'id');
} }
public function rUsers() public function rUsers()
{ {
return $this->hasOne(Users::class, 'id', 'idpegawai'); return $this->hasOne(Users::class, 'idpegawai', 'id');
} }
public function rAgenda() public function rAgenda()
......
...@@ -11,11 +11,15 @@ class Role extends Model ...@@ -11,11 +11,15 @@ class Role extends Model
protected $table = 'role'; protected $table = 'role';
protected $fillable = [ protected $fillable = [
'id', 'nama','created_at', 'updated_at', 'deleted_at', 'id',
'nama',
'created_at',
'updated_at',
'deleted_at',
]; ];
public function rUser() public function rUser()
{ {
return $this->hasMany(Users::class, 'id', 'idrole'); return $this->belongsToMany(Users::class, 'idrole', 'id');
} }
} }
...@@ -11,16 +11,23 @@ class Unit extends Model ...@@ -11,16 +11,23 @@ class Unit extends Model
protected $table = 'ms_unit'; protected $table = 'ms_unit';
protected $fillable = [ protected $fillable = [
'id', 'idsatker', 'idparentsatker', 'namasatker', 'status', 'created_at', 'updated_at', 'deleted_at', 'id',
'idsatker',
'idparentsatker',
'namasatker',
'status',
'created_at',
'updated_at',
'deleted_at',
]; ];
public function rAgenda() public function rAgenda()
{ {
return $this->hasMany(Agenda::class, 'id', 'idunit'); return $this->hasMany(Agenda::class, 'idunit', 'id');
} }
public function rPegawai() public function rPegawai()
{ {
return $this->hasMany(Pegawai::class, 'id', 'idunit'); return $this->hasMany(Pegawai::class, 'idunit', 'id');
} }
} }
...@@ -11,7 +11,13 @@ class UserAgenda extends Model ...@@ -11,7 +11,13 @@ class UserAgenda extends Model
protected $table = 'tr_agenda_pegawai'; protected $table = 'tr_agenda_pegawai';
protected $fillable = [ protected $fillable = [
'id', 'idpegawai', 'idagenda', 'statuskehadiran', 'created_at', 'updated_at', 'deleted_at', 'id',
'idpegawai',
'idagenda',
'statuskehadiran',
'created_at',
'updated_at',
'deleted_at',
]; ];
// public function rPegawai() // public function rPegawai()
...@@ -22,5 +28,5 @@ class UserAgenda extends Model ...@@ -22,5 +28,5 @@ class UserAgenda extends Model
// public function rAgenda() // public function rAgenda()
// { // {
// return $this->hasOne(UserAgenda::class, 'idagenda', 'id'); // return $this->hasOne(UserAgenda::class, 'idagenda', 'id');
// } // }
} }
...@@ -11,16 +11,23 @@ class Users extends Model ...@@ -11,16 +11,23 @@ class Users extends Model
protected $table = 'user'; protected $table = 'user';
protected $fillable = [ protected $fillable = [
'id', 'nama', 'email', 'password', 'idrole', 'idpegawai', 'created_at', 'updated_at', 'id',
'nama',
'email',
'password',
'idrole',
'idpegawai',
'created_at',
'updated_at',
]; ];
public function rRole() public function rRole()
{ {
return $this->belongsTo(Role::class, 'idrole', 'id'); return $this->hasOne(Role::class, 'idrole', 'id');
} }
public function rPegawai() public function rPegawai()
{ {
return $this->hasOne(Pegawai::class, 'idpegawai', 'id'); return $this->belongsTo(Pegawai::class, 'idpegawai', 'id');
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment