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'); } }