update model jenispenilaian, penilaian dan teamsusers

This commit is contained in:
majid 2024-09-06 08:50:57 +07:00
parent 479860d12d
commit a51d5fbeff
3 changed files with 12 additions and 9 deletions

View File

@ -18,5 +18,8 @@ class JenisPenilaian extends Model
'created_at', 'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
];
public function penilaian(){
return $this->hasMany(Penilaian::class , 'jenis_penilaian_id', 'id');
}
}

View File

@ -17,21 +17,21 @@ class Penilaian extends Model
*/
protected $table = 'penilaian';
protected $fillable = [
'jenis_penilaian_id', 'team_id', 'user_id', 'tanggal_kunjungan', 'keterangan',
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
'jenis_penilaian_id', 'team_id', 'user_id', 'tanggal_kunjungan', 'keterangan',
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
];
public function jenis_penilaian(){
return $this->hasMany(JenisPenilaian::class);
return $this->belongsTo(JenisPenilaian::class, 'jenis_penilaian_id', 'id');
}
public function teams(){
return $this->hasMany(Teams::class);
return $this->belongsTo(Teams::class, 'team_id', 'id');
}
public function users(){
return $this->hasMany(User::class);
return $this->belongsTo(User::class, 'user_id', 'id');
}

View File

@ -15,18 +15,18 @@ class TeamsUsers extends Model
*/
protected $table = 'teams_users';
protected $fillable = [
'team_id', 'user_id', 'status', 'authorized_status', 'authorized_at',
'authorized_by', 'created_at', 'created_by', 'updated_at', 'updated_by',
'team_id', 'user_id', 'status', 'authorized_status', 'authorized_at',
'authorized_by', 'created_at', 'created_by', 'updated_at', 'updated_by',
'deleted_at', 'deleted_by'
];
public function team()
{
return $this->belongsTo(Teams::class, 'team_id');
return $this->belongsTo(Teams::class, 'team_id', 'id');
}
public function user()
{
return $this->belongsTo(User::class, 'user_id');
return $this->belongsTo(User::class, 'user_id', 'id');
}
}