Skip to content

Commit 9c8cff7

Browse files
authored
Add users() allowing a closure feature to the readme.
1 parent f6f0cc3 commit 9c8cff7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Register the plugin in the Filament panel provider (the default file is `app/Pro
2323

2424
In the `users` method you can define the users (note: the users must exist), the key is used as a label on the login button and the value is used to search the user in the database.
2525

26+
2627
```php
2728
// ...
2829
->plugins([
@@ -35,6 +36,15 @@ In the `users` method you can define the users (note: the users must exist), the
3536
]);
3637
```
3738

39+
The users() method can also be passed a closure to compute the users list at render time, for example from the database.
40+
41+
```php
42+
// ...
43+
FilamentDeveloperLoginsPlugin::make()
44+
->users(fn () => User::pluck('email', 'name')->toArray())
45+
]);
46+
```
47+
3848
## Customization
3949

4050
### enabled()
@@ -113,7 +123,7 @@ FilamentDeveloperLoginsPlugin::make()
113123
->modelClass(Admin::class)
114124
```
115125

116-
### RedirectTo()
126+
### redirectTo()
117127

118128
By default, the user will be redirected using the `Filament::getUrl()` method, which directs them to the dashboard. In the case of multi-tenancy, the user will also be redirected to the correct tenant. If you prefer to use a different url, you can utilize the redirectTo() method.
119129

0 commit comments

Comments
 (0)