Manage your users with a highly customizable user resource for FilamentPHP with integration of filament-shield and filament-impersonate.
for filament v2 please use this repo
- Users Resource
- Allow To Publish User Resource
- Allow To Use Shield
- Allow To Use Impersonate
- Allow To Use Facade Class to custom the current user resource
- Integration with Laravel Jetstream teams
- custom User model from config file
- custom Team model from config file
- custom Role model from config file
- Allow User Avatars
- Laravel Jetsream user profile page
- Custom Register/Login Pages for Laravel Jetstream
- Add OTP Page to Register process
composer require tomatophp/filament-usersfinally register the plugin on /app/Providers/Filament/AdminPanelProvider.php
->plugin(\TomatoPHP\FilamentUsers\FilamentUsersPlugin::make())you can use the shield to protect your resource and allow user roles by install it first
composer require bezhansalleh/filament-shieldAdd the Spatie\Permission\Traits\HasRoles trait to your User model(s):
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
use HasRoles;
// ...
}Publish the config file then setup your configuration:
->plugin(\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make())Now run the following command to install shield:
php artisan shield:setup
php artisan shield:super_adminNow we can publish the package assets.
php artisan vendor:publish --tag="filament-users-config"now on your filament-users.php config allow shield
/*
* User Filament Shield
*/
"shield" => true,now clear your config
php artisan config:cache
php artisan optimizefor more information check the Filament Shield
now on your filament-users.php config allow shield
/*
* User Filament Impersonate
*/
"impersonate" => [
'enable' => true
],now clear your config
php artisan config:cache
php artisan optimizeyou can use the Laravel Jetstream Teams by install it first
composer require laravel/jetstreamafter that just publish the migration and models
php artisan filament-users:teamsnow you need to migrate the teams migration
php artisan migratenow on your filament-users.php config allow shield
/*
* User Filament Teams
*/
"teams" => true,now clear your config
php artisan config:cache
php artisan optimizeyou can custom the resource by just extend it and then make ->useUserResource(false) or ->useTeamsResource(false) to the plugin
you can register the user relation manager to your project
use TomatoPHP\FilamentUsers\Facades\FilamentUser;
public function boot()
{
FilamentUser::register([
\Filament\Resources\RelationManagers\RelationManager::make() // Replace with your custom relation manager
]);
}we have add a lot of hooks to make it easy to attach actions, columns, filters, etc
use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserTable;
public function boot()
{
UsersTable::register([
\Filament\Tables\Columns\TextColumn::make('something')
]);
}use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserActions;
public function boot()
{
UserActions::register([
\Filament\Tables\Actions\ReplicateAction::make()
]);
}use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserFilters;
public function boot()
{
UserFilters::register([
\Filament\Tables\Filters\SelectFilter::make('something')
]);
}use TomatoPHP\FilamentUsers\Filament\Resources\Users\Tables\UserBulkActions;
public function boot()
{
UserBulkActions::register([
\Filament\Tables\BulkActions\DeleteAction::make()
]);
}use TomatoPHP\FilamentUsers\Filament\Resources\Users\Schemas\UserForm;
public function boot()
{
UserForm::register([
\Filament\Forms\Components\TextInput::make('something')
]);
}use TomatoPHP\FilamentUsers\Filament\Resources\Users\Schemas\UserInfolist;
public function boot()
{
UserInfolist::register([
\Filament\Infolists\Components\TextEntry::make('something')
]);
}you can customize all resource classes to be any class you want with the same return from the config file
/**
* ---------------------------------------------
* Resource Building
* ---------------------------------------------
* if you want to use the resource custom class
*/
'resource' => [
'table' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserTable::class,
'filters' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserFilters::class,
'actions' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserActions::class,
'bulkActions' => \TomatoPHP\FilamentUsers\Resources\UserResource\Table\UserBulkActions::class,
],
'form' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\Schemas\UserForm::class
],
'infolist' => [
'class' => \TomatoPHP\FilamentUsers\Resources\UserResource\Schemas\UserInfolist::class
]
]you can use the simple user resource by change on config, on your filament-users.php config allow simple
/**
* ---------------------------------------------
* Use Simple Resource
* ---------------------------------------------
* change the resource from pages to modals by allow simple resource.
*/
'simple' => true,you can use User Avatar by just add ->useAvatar() to the plugin
you can publish config file by use this command
php artisan vendor:publish --tag="filament-users-config"you can publish languages file by use this command
php artisan vendor:publish --tag="filament-users-lang"if you like to run PEST testing just use this command
composer testif you like to fix the code style just use this command
composer formatif you like to check the code by PHPStan just use this command
composer analyseCheckout our Awesome TomatoPHP









