@@ -29,28 +29,42 @@ public string $defaultAuthenticator = 'session';
2929
3030## Auth Helper
3131
32- The auth functionality is designed to be used with the ` auth_helper ` that comes with Shield. This
33- helper method provides the ` auth() ` function which returns a convenient interface to the most frequently
34- used functionality within the auth libraries.
32+ The auth functionality is designed to be used with the ` auth_helper ` that comes
33+ with Shield.
34+
35+ !!! note
36+
37+ The `auth_helper` is autoloaded by CodeIgniter's autoloader if you follow the
38+ installation instruction. If you want to *override* the functions, create
39+ **app/Helpers/auth_helper.php**.
40+
41+ ### Getting the Current User
42+
43+ The ` auth() ` function returns a convenient interface to the most frequently used
44+ functionality within the auth libraries.
45+
46+ You can get the current ` User ` entity.
3547
3648``` php
3749// get the current user
38- auth()->user();
50+ $user = auth()->user();
3951
4052// get the current user's id
41- auth()->id();
53+ $user_id = auth()->id();
4254// or
43- user_id();
44-
45- // get the User Provider (UserModel by default)
46- auth()->getProvider();
55+ $user_id = user_id();
4756```
4857
49- !!! note
58+ The ` user_id() ` function returns the current user's id.
5059
51- The `auth_helper` is autoloaded by CodeIgniter's autoloader if you follow the
52- installation instruction. If you want to *override* the functions, create
53- **app/Helpers/auth_helper.php**.
60+ ### Getting the User Provider
61+
62+ You can also get the User Provider.
63+
64+ ``` php
65+ // get the User Provider (UserModel by default)
66+ $users = auth()->getProvider();
67+ ```
5468
5569## Authenticator Responses
5670
0 commit comments