Parent Corporate

This commit is contained in:
R
2022-09-01 16:03:52 +07:00
parent 2eb955467d
commit 2215f61db4
9 changed files with 190 additions and 21 deletions

View File

@@ -12,6 +12,8 @@ class Corporate extends Model
use HasFactory, SoftDeletes, Blameable;
protected $fillable = [
'type',
'parent_id',
'code',
'name',
'welcome_message',
@@ -89,4 +91,14 @@ class Corporate extends Model
{
return $this->hasMany(CorporateService::class, 'corporate_id');
}
public function parent()
{
return $this->belongsTo(Corporate::class, 'parent_id');
}
public function subCorporates()
{
return $this->hasMany(Corporate::class, 'parent_id');
}
}