This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ # The Basics
2+
3+ ## Creating
4+
5+ ## Updating
6+
7+ ## Deleting
8+
9+ ## Moving
10+
11+ ## Renaming
Original file line number Diff line number Diff line change @@ -120,3 +120,48 @@ $jdoe->userAccountControl = $uac->getValue();
120120
121121$jdoe->save();
122122```
123+
124+ You can also use 'setter' methods to perform the same task.
125+
126+ ``` php
127+ $jdoe = Adldap::search()->users()->find('jdoe');
128+
129+ $uac = new Adldap\Models\Attributes\AccountControl();
130+
131+ $uac->accountIsNormal();
132+
133+ $jdoe
134+ ->setDepartment('Accounting');
135+ ->setTelephoneNumber('555 555-5555')
136+ ->setMobileNumber('555 555-5555')
137+ ->setUserAccountControl($uac);
138+
139+ $jdoe->save();
140+ ```
141+
142+ Using setter methods offer a little bit of benefit, for example you can see above that
143+ ` $uac->getValue() ` does not need to be called as the ` setUserAccountControl() ` method
144+ will automatically convert an ` AccountControl ` object to its integer value.
145+
146+ Setter methods are also chainable (if you prefer that syntax).
147+
148+ ## Deleting Users
149+
150+ As any other returned model in Adldap2, you can call the ` delete() ` method
151+ to delete a user from your directory:
152+
153+ ``` php
154+ $user = Adldap::search()->find('jdoe');
155+
156+ $user->delete();
157+ ```
158+
159+ Once you ` delete() ` a user (successfully), the ` exists ` property on their model is set to ` false ` :
160+
161+ ``` php
162+ $user = Adldap::search()->find('jdoe');
163+
164+ $user->delete();
165+
166+ var_dump($user->exists); // Returns 'bool(false)'
167+ ```
You can’t perform that action at this time.
0 commit comments