Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public $defaultAuthenticator = 'session';
## Auth Helper

The auth functionality is designed to be used with the `auth_helper` that comes with Shield. This
helper method provides the `auth()` command which returns a convenient interface to the most frequently
helper method provides the `auth()` function which returns a convenient interface to the most frequently
used functionality within the auth libraries.

```php
Expand All @@ -61,6 +61,9 @@ auth()->user();
auth()->id();
// or
user_id();

// get the User Provider (UserModel by default)
auth()->getProvider();
```

> **Note**
Expand Down
13 changes: 9 additions & 4 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ By default, the only values stored in the users table is the username. The first
```php
use CodeIgniter\Shield\Entities\User;

$users = model('UserModel');
// Get the User Provider (UserModel by default)
$users = auth()->getProvider();

$user = new User([
'username' => 'foo-bar',
'email' => 'foo.bar@example.com',
Expand All @@ -291,7 +293,9 @@ $users->addToDefaultGroup($user);
A user's data can be spread over a few different tables so you might be concerned about how to delete all of the user's data from the system. This is handled automatically at the database level for all information that Shield knows about, through the `onCascade` settings of the table's foreign keys. You can delete a user like any other entity.

```php
$users = model('UserModel');
// Get the User Provider (UserModel by default)
$users = auth()->getProvider();

$users->delete($user->id, true);
```

Expand All @@ -302,9 +306,10 @@ $users->delete($user->id, true);
The `UserModel::save()`, `update()` and `insert()` methods have been modified to ensure that an email or password previously set on the `User` entity will be automatically updated in the correct `UserIdentity` record.

```php
$users = model('UserModel');
$user = $users->findById(123);
// Get the User Provider (UserModel by default)
$users = auth()->getProvider();

$user = $users->findById(123);
$user->fill([
'username' => 'JoeSmith111',
'email' => 'joe.smith@example.com',
Expand Down