Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace LdapRecord\Models\Concerns; |
| 4 | |
| 5 | trait 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 | } |