ryangjchandler / filament-user-resource
A simple resource for managing users in Filament.
Fund package maintenance!
ryangjchandler
Requires
- php: ^8.1
- filament/filament: ^2.0
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-11-09 12:05:40 UTC
README
This package provides a UserResource
class that lets you create and update User
models from Filament. This is designed to work with Laravel's default User
model.
Installation
You can install the package via Composer:
composer require ryangjchandler/filament-user-resource
You can publish the config file with:
php artisan vendor:publish --tag="filament-user-resource-config"
Usage
The UserResource
class is automatically registered with Filament so there's very little setup.
Enabling password changes
By default, the password for a User
can't be updated from Filament. This is a personal preference, but can be enabled by calling UserResource::enablePasswordUpdates()
inside of a service provider.
use RyanChandler\FilamentUserResources\Resources\UserResource; public function boot() { UserResource::enablePasswordUpdates(); }
You can also provide a callback function to this method to conditionally enable password updates, e.g. allowing administrators to update passwords but not other users.
use RyanChandler\FilamentUserResources\Resources\UserResource; public function boot() { UserResource::enablePasswordUpdates(function (): bool { return auth()->user()->role === Role::Admin; }); }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.