Ability to set up a custom users table #72
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #30, #67 and part of #58.
It introduces a new configuration option -
filament.auth.guard
- which can be set to the name of any guard in your app. The user model provided to that guard must implementFilament\Models\Contracts\FilamentUser
and use theFilament\Models\Concerns\IsFilamentUser
trait. You may specify a few properties on the custom model to tweak the default behaviour:$filamentAdminColumn
can be set to the name of a column that dictates if the user is a Filament admin (superuser).$filamentAvatarColumn
can be set to the name of a column that stores the path to the user's avatar.$filamentRolesColumn
can be set to the name of a column that stores Filament roles. If none is provided, role functionality is disabled.$filamentUserColumn
can be set to the name of a column that dictates if the user can access Filament or not.These properties are accompanied by methods such as
canAccessFilament()
andisFilamentAdmin()
that can be overwritten to customise the experience further.Since the user model may now contain extra properties not present in the default UserResource, you may publish and customise it using
php artisan vendor:publish --tag=filament-user-resource
, and setting thefilament.user_resource
config to\App\Filament\Resources\UserResource::class
.