filament-shield is installed (composer require bezhansalleh/filament-shield).composer require 3x1io/filament-user.php artisan vendor:publish --tag="filament-user-config"
php artisan vendor:publish --tag="filament-user-translations"
php artisan optimize:clear
php artisan filament-user:publish
Set publish_resource = true in config/filament-user.php./admin/resources/users in your Filament admin panel.name, email, password, is_admin, and last_login_at.User Management:
is_admin) via the table actions dropdown.Authentication Integration:
App\Models\User if using custom fields.Role/Permission Sync:
filament-shield are automatically reflected in the is_admin field. Customize via:
// config/filament-user.php
'shield_roles' => ['admin', 'editor'], // Sync these roles to `is_admin`
Custom Fields:
publish_resource = true), modify app/Filament/Resources/UserResource.php to add fields:
public static function form(Form $form): Form
{
return $form
->schema([
// Default fields...
TextInput::make('custom_field')->required(),
]);
}
API Access:
filament-shield for permissions.UserResource (e.g., filter users by tenant_id):
public static function table(Table $table): Table
{
return $table
->query(fn (Builder $query) => $query->where('tenant_id', auth()->user()->tenant_id));
}
afterCreate/afterUpdate hooks:
protected static function afterCreate(User $record): void
{
Notification::route('mail', $record->email)->notify(new WelcomeNotification());
}
Missing filament-shield:
Class 'FilamentShield\FilamentShield' not found.filament-shield first (composer require bezhansalleh/filament-shield).Resource Not Publishing:
filament-user:publish.publish_resource in config/filament-user.php is set to true and run composer dump-autoload.Field Conflicts:
UserResource clash with default fields.app/Filament/Resources/ and modifying it.Permission Denied:
is_admin field not syncing with filament-shield roles.shield_roles in config/filament-user.php matches your filament-shield role names.UserResource hooks:
protected static function afterSave(User $record): void
{
\Log::info("User updated: {$record->email}", ['action' => 'update']);
}
Custom Auth Logic:
app/Providers/FilamentUserServiceProvider.php to extend auth logic:
public function boot(): void
{
User::observe(UserObserver::class);
}
Dynamic Fields:
TextInput::make('api_token')
->visible(fn ($record) => $record->is_admin),
Webhooks:
afterCreate/afterDelete:
protected static function afterCreate(User $record): void
{
Http::post('https://slack.com/webhook', ['text' => "New user: {$record->email}"]);
}
Testing:
$this->filament()->actingAs(User::factory()->create(['is_admin' => true]))
->get('/admin/resources/users')
->assertOk();
shield_roles Array: Must match exactly the role names defined in filament-shield. Case-sensitive.UserResource:
public static function table(Table $table): Table
{
return $table->defaultSort('created_at', 'desc');
}
resources/lang/vendor/filament-user/ after publishing translations.How can I help you explore Laravel packages today?