|
7 | 7 | [](https://packagist.org/packages/adldap2/adldap2-laravel) |
8 | 8 | [](https://packagist.org/packages/adldap2/adldap2-laravel) |
9 | 9 |
|
10 | | -Adldap2 - Laravel allows easy configuration, access, management and authentication to LDAP connections utilizing the root |
11 | | -[Adldap2 Repository](http://www.github.com/Adldap2/Adldap2). |
| 10 | +Easy configuration, access, management and authentication to LDAP servers utilizing the root |
| 11 | +[Adldap2](http://www.github.com/Adldap2/Adldap2) repository. |
12 | 12 |
|
13 | 13 | ## Requirements |
14 | 14 |
|
@@ -74,30 +74,38 @@ Now you're all set! |
74 | 74 |
|
75 | 75 | First, configure your LDAP connection in the `config/adldap.php` file. |
76 | 76 |
|
77 | | -Then, you can perform all methods on your Adldap connection through its facade like so: |
| 77 | +Then, you can perform methods on your default connection through the `Adldap` facade like so: |
78 | 78 |
|
79 | 79 | ```php |
80 | 80 | use Adldap\Laravel\Facades\Adldap; |
81 | 81 |
|
82 | | -// Finding a user. |
| 82 | +// Finding a user: |
83 | 83 | $user = Adldap::search()->users()->find('john doe'); |
84 | 84 |
|
85 | | -// Searching for a user. |
| 85 | +// Searching for a user: |
86 | 86 | $search = Adldap::search()->where('cn', '=', 'John Doe')->get(); |
87 | 87 |
|
88 | 88 | // Running an operation under a different connection: |
89 | 89 | $users = Adldap::getProvider('other-connection')->search()->users()->get(); |
90 | 90 |
|
91 | | -// Creating a user. |
| 91 | +// Creating a user: |
92 | 92 | $user = Adldap::make()->user([ |
93 | 93 | 'cn' => 'John Doe', |
94 | 94 | ]); |
95 | 95 |
|
| 96 | +// Saving a user: |
96 | 97 | $user->save(); |
97 | 98 | ``` |
98 | 99 |
|
99 | | -Or you can inject the Adldap interface into your controllers, which gives |
100 | | -you access to all of your LDAP connections and resources. |
| 100 | +If you do not specify an alternate connection using `getProvider()`, your |
| 101 | +`default` connection will be utilized for all methods. |
| 102 | + |
| 103 | +Upon performing operations without specifying a connection, your default |
| 104 | +connection will be connected to and bound automatically |
| 105 | +using your configured username and password. |
| 106 | + |
| 107 | +If you would prefer, you can also inject the Adldap interface into your controllers, |
| 108 | +which gives you access to all of your LDAP connections and resources as the facade. |
101 | 109 |
|
102 | 110 | ```php |
103 | 111 | use Adldap\AdldapInterface; |
@@ -130,7 +138,19 @@ class UserController extends Controller |
130 | 138 |
|
131 | 139 | return view('users.index', compact('users')); |
132 | 140 | } |
| 141 | + |
| 142 | + /** |
| 143 | + * Displays the specified LDAP user. |
| 144 | + * |
| 145 | + * @return \Illuminate\View\View |
| 146 | + */ |
| 147 | + public function show($id) |
| 148 | + { |
| 149 | + $user = $this->ldap->search()->findByGuid($id); |
| 150 | + |
| 151 | + return view('users.show', compact('user')); |
| 152 | + } |
133 | 153 | } |
134 | 154 | ``` |
135 | 155 |
|
136 | | -To see more usage in detail, please visit the [Adldap2 Repository](http://github.com/Adldap2/Adldap2). |
| 156 | +To see more usage in detail, please visit the [Adldap2](http://github.com/Adldap2/Adldap2) repository. |
0 commit comments