User management module for the Afea Filament CMS package ecosystem.
Ships:
UserResource— list/create/edit users with role attachmentRoleResource— list/create/edit roles with permission assignment (checkbox list)SuperAdminRoleSeeder— idempotent seed for thesuper_adminroleUsersPlugin+afea:install:usersinstaller
Wraps spatie/laravel-permission which is already required by afea/filament-cms-core — this package just adds the Filament admin UI and lifecycle commands.
composer require afea/filament-users
php artisan afea:install:usersThen 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')AFEA_USERS_USER_MODEL="App\\Models\\AdminUser"Or set the full config key:
// config/afea-users.php
'models' => [
'user' => \App\Models\AdminUser::class,
],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.
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 --forceThe 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=adminSkip Shield with --skip-shield even when it is installed (useful for CI).