phpsa/filament-authentication
auth() helper, HasApiTokens, MustVerifyEmail), reducing friction for existing Laravel apps.n+1 queries in bulk operations). Mitigate with Spatie’s eager loading.database, session, and API tokens (if using Sanctum/Passport).users table schema, role logic).composer require filament/filament:^3.0 if upgrading).composer require phpsa/filament-authentication spatie/laravel-permission
php artisan filament-authentication:install
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
php artisan migrate
php artisan vendor:publish --tag=filament-authentication-views
php artisan vendor:publish --tag=filament-authentication-translations
config/filament.php to include the auth resource in the admin panel.Authenticatable or MustVerifyEmail, ensure the package’s User model aligns with your traits/interfaces.User model can be extended to support additional fields (e.g., provider_id).php artisan make:auth or Breeze) for fallback.users, roles, and permissions tables.config/filament.php).resources/user/pages/edit.php).admin, editor).auth:sanctum → auth:sanctum,role:admin) if using Spatie’s gates.composer why-not phpsa/filament-authentication to check for version conflicts.can() method usage (e.g., auth()->user()->can('edit-posts')).model_has_roles).config/filament.php.php artisan filament:resources (list all Filament resources).php artisan tinker to test Spatie’s permission logic.syncRoles()) can be slow for large datasets. Use transactions:
DB::transaction(function () {
$user->syncRoles(['admin', 'editor']);
});
public function handle(Request $request, Closure $next) {
if (!auth()->user()->can('access
How can I help you explore Laravel packages today?