[WIP] Improvement
This commit is contained in:
@@ -63,6 +63,18 @@ class Corporate extends Model
|
||||
return $this->hasMany(CorporateDivision::class, 'corporate_id');
|
||||
}
|
||||
|
||||
public function employees()
|
||||
{
|
||||
return $this->belongsToMany(Member::class, 'corporate_employees', 'corporate_id', 'member_id')->withPivot([
|
||||
'branch_code',
|
||||
'division_id',
|
||||
'nik',
|
||||
'status',
|
||||
'start',
|
||||
'end'
|
||||
]);
|
||||
}
|
||||
|
||||
public function importLogs()
|
||||
{
|
||||
return $this->morphMany(ImportLog::class, 'importable');
|
||||
|
||||
@@ -41,4 +41,9 @@ class User extends Authenticatable
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function managedCorporates()
|
||||
{
|
||||
return $this->belongsToMany(Corporate::class, 'corporate_manager', 'user_id', 'corporate_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user