diff --git a/app/Models/Branch.php b/app/Models/Branch.php index 5d828fa..c4955ed 100644 --- a/app/Models/Branch.php +++ b/app/Models/Branch.php @@ -1,43 +1,49 @@ belongsTo(Branch::class, 'parent_id'); - } - - /** - * Get the child branches of this branch - */ - public function children() - { - return $this->hasMany(Branch::class, 'parent_id'); - } + return $this->belongsTo(Branch::class, 'parent_id'); } + + /** + * Get the child branches of this branch + */ + public function children() + { + return $this->hasMany(Branch::class, 'parent_id'); + } + + + public function users() + { + return $this->belongsToMany(Modules\Usermanagement\Models\User::class, 'user_branches', 'branch_id', 'user_id'); + } +}