blob: 6c97cf9257e3b2c16e134fd4c067d4ac11aee225 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace LdapRecord\Models\Concerns;
4
5trait HasScopes
6{
7 /**
8 * Begin querying the direct descendants of the model.
9 *
10 * @return \LdapRecord\Query\Model\Builder
11 */
12 public function descendants()
13 {
14 return $this->in($this->getDn())->listing();
15 }
16
17 /**
18 * Begin querying the direct ancestors of the model.
19 *
20 * @return \LdapRecord\Query\Model\Builder
21 */
22 public function ancestors()
23 {
24 $parent = $this->getParentDn($this->getDn());
25
26 return $this->in($this->getParentDn($parent))->listing();
27 }
28
29 /**
30 * Begin querying the direct siblings of the model.
31 *
32 * @return \LdapRecord\Query\Model\Builder
33 */
34 public function siblings()
35 {
36 return $this->in($this->getParentDn($this->getDn()))->listing();
37 }
38}