'like', 'id' => '<>' ]; protected bool $asTree = true; /** * * @return BelongsToMany */ public function permissions(): BelongsToMany { return $this->belongsToMany(Permissions::class, 'role_has_permissions', 'role_id', 'permission_id'); } /** * departments * * @return BelongsToMany */ public function departments(): BelongsToMany { return $this->belongsToMany(Departments::class, 'role_has_departments', 'role_id', 'department_id'); } /** * get role's permissions * @return Collection */ public function getPermissions(): Collection { return $this->permissions()->get(); } /** * get role's departments * @return Collection */ public function getDepartments(): Collection { return $this->departments()->get(); } }