Skip to content

Commit e2652ae

Browse files
committed
docs: move how to customize User Provider to customization.md
1 parent baf432c commit e2652ae

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

docs/concepts.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,10 @@ on the standard Config class if nothing is found in the database.
2525

2626
## User Providers
2727

28-
You can use your own models to handle user persistence. Shield calls this the "User Provider" class.
29-
A default model is provided for you by the `CodeIgniter\Shield\Models\UserModel` class. You can change
30-
this in the `Config\Auth::$userProvider` setting. The only requirement is that your new class
31-
MUST extend the provided `UserModel`.
28+
Shield has a model to handle user persistence. Shield calls this the "User Provider" class.
29+
A default model is provided for you by the `CodeIgniter\Shield\Models\UserModel` class.
3230

33-
Shield has a CLI command to quickly create a custom `UserModel` class by running the following
34-
command in the terminal:
35-
36-
```console
37-
php spark shield:model UserModel
38-
```
39-
40-
The class name is optional. If none is provided, the generated class name would be `UserModel`.
41-
42-
You should set `Config\Auth::$userProvider` as follows:
43-
44-
```php
45-
public string $userProvider = \App\Models\UserModel::class;
46-
```
31+
You can use your own model. See [Customizing Shield](./customization.md#custom-user-provider) for details.
4732

4833
## User Identities
4934

docs/customization.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [Custom Validation Rules](#custom-validation-rules)
99
- [Registration](#registration)
1010
- [Login](#login)
11+
- [Custom User Provider](#custom-user-provider)
1112

1213
## Route Configuration
1314

@@ -181,3 +182,25 @@ Similar to the process for validation rules in the **Registration** section, you
181182
],
182183
];
183184
```
185+
186+
## Custom User Provider
187+
188+
You can use your own "[User Provider](./concepts.md#user-providers)" class.
189+
A default model is provided for you by the `CodeIgniter\Shield\Models\UserModel` class. You can change
190+
this in the `Config\Auth::$userProvider` setting. The only requirement is that your new class
191+
MUST extend the provided `UserModel`.
192+
193+
Shield has a CLI command to quickly create a custom `UserModel` class by running the following
194+
command in the terminal:
195+
196+
```console
197+
php spark shield:model UserModel
198+
```
199+
200+
The class name is optional. If none is provided, the generated class name would be `UserModel`.
201+
202+
You should set `Config\Auth::$userProvider` as follows:
203+
204+
```php
205+
public string $userProvider = \App\Models\UserModel::class;
206+
```

0 commit comments

Comments
 (0)