afea/filament-users

User management module for the Afea Filament CMS package ecosystem: user listing/editing, role management and permission assignment backed by spatie/laravel-permission.

Maintainers

Package info

github.com/AfeaSoftware/filament-users

pkg:composer/afea/filament-users

Statistics

Installs: 1

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-21 10:48 UTC

This package is auto-updated.

Last update: 2026-04-21 11:57:59 UTC


README

User management module for the Afea Filament CMS package ecosystem.

Ships:

  • UserResource — list/create/edit users with role attachment
  • RoleResource — list/create/edit roles with permission assignment (checkbox list)
  • SuperAdminRoleSeeder — idempotent seed for the super_admin role
  • UsersPlugin + afea:install:users installer

Wraps spatie/laravel-permission which is already required by afea/filament-cms-core — this package just adds the Filament admin UI and lifecycle commands.

Installation

composer require afea/filament-users
php artisan afea:install:users

Then add the HasRoles trait to your App\Models\User:

use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable
{
    use HasRoles;
    // ...
}

Register in AdminPanelProvider:

->plugin(\Afea\Cms\Users\Filament\UsersPlugin::make())

Grant yourself the super-admin role:

php artisan tinker
>>> App\Models\User::first()->assignRole('super_admin')

Three common scenarios

1. Use a different User subclass

AFEA_USERS_USER_MODEL="App\\Models\\AdminUser"

Or set the full config key:

// config/afea-users.php
'models' => [
    'user' => \App\Models\AdminUser::class,
],

2. Seed domain-specific permissions

Create your own seeder alongside SuperAdminRoleSeeder:

namespace Database\Seeders;

use Spatie\Permission\Models\Permission;

class PermissionSeeder extends \Illuminate\Database\Seeder
{
    public function run(): void
    {
        collect(['view_posts', 'create_posts', 'edit_posts', 'delete_posts'])
            ->each(fn ($name) => Permission::findOrCreate($name, 'web'));
    }
}

Then call php artisan db:seed --class=Database\\Seeders\\PermissionSeeder.

3. Filament Shield — auto-generated policies

bezhansalleh/filament-shield is a first-class companion. Install it before running our installer and we auto-run shield:install + shield:generate --all for you:

composer require bezhansalleh/filament-shield
php artisan afea:install:users --force

The installer detects Shield via the shield:install Artisan command, asks for confirmation, and passes the configured panel id (default admin, change with --panel-id=cms). The super_admin role we seed matches Shield's convention, so existing accounts keep working.

If you install Shield after running our installer, just run Shield's commands manually:

php artisan shield:install admin
php artisan shield:generate --all --panel=admin

Skip Shield with --skip-shield even when it is installed (useful for CI).