Parent Corporate
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user