mortezamasumi / fb-user
User model, migrations and a Filament resource for Laravel.
Requires
- php: ^8.5
- filament/filament: ^5.0
- mortezamasumi/fb-auth: ^5.0
- mortezamasumi/fb-essentials: ^5.0
- mortezamasumi/fb-profile: ^5.0
- spatie/laravel-package-tools: ^1.0
Requires (Dev)
- filament/upgrade: ^5.0
- larastan/larastan: ^3.10
- laravel/pint: ^1.30
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-browser: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- pestphp/pest-plugin-livewire: ^4.0
- phpstan/phpstan: ^2.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v5.3.1
- v5.3.0
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.5.6
- v4.5.5
- v4.5.4
- v4.5.3
- v4.5.2
- v4.5.1
- v4.5.0
- v4.4.1
- v4.4.0
- v4.3.5
- v4.3.4
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.5
- v4.2.4
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.15
- v4.1.14
- v4.1.13
- v4.1.12
- v4.1.11
- v4.1.10
- v4.1.9
- v4.1.8
- v4.1.7
- v4.1.6
- v4.1.5
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.28
- v4.0.27
- v4.0.26
- v4.0.25
- v4.0.24
- v4.0.23
- v4.0.22
- v4.0.21
- v4.0.20
- v4.0.19
- v4.0.18
- v4.0.17
- v4.0.16
- v4.0.15
- v4.0.14
- v4.0.13
- v4.0.12
- v4.0.11
- v4.0.10
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.0.0
- v2.0.0
- v1.0.0
This package is auto-updated.
Last update: 2026-09-08 07:53:19 UTC
README
A Filament panel plugin that provides a user model, migrations and a complete UserResource (list, create, edit, import and export) for Laravel applications.
Features
- User resource — full CRUD with a sortable, filterable table and role support
- Cascade operations — keep related records (e.g. students, nurses) in sync when a user is deleted, force-deleted or restored
- Role-based visibility — super-admins see all users; non-super-admins only see users without a role
- Scheduled cleanup — an hourly job removes users that have been unattended for a configurable number of hours
- Import & export — CSV import (with role assignment and gender/date handling) and export built on Filament actions
- No-role widget — an optional dashboard widget that renders when the authenticated user has no role
- Localized — ships English and Persian translations
Installation
composer require mortezamasumi/fb-user
Publish and run the migrations:
php artisan vendor:publish --tag="fb-user-migrations"
php artisan migrate
Add the plugin to your Filament panel provider:
use Mortezamasumi\FbUser\FbUserPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FbUserPlugin::make(), ]); }
Configuration
Publish the config file:
php artisan vendor:publish --tag="fb-user-config"
| Key | Default | Description |
|---|---|---|
remove_unattend_user_hours |
48 |
Hours after which unattended users are removed by the hourly job |
default_users_list_filter |
all |
Initial active filter state on the users list (all or active) |
navigation.* |
— | Filament navigation label, group, icon and sort options for the resource |
Usage
The User model
The package ships an abstract Mortezamasumi\FbUser\Models\User base model. Extend it in your application so the resource and auth guard share one class:
use Mortezamasumi\FbUser\Models\User as BaseUser; class User extends BaseUser { // your application-specific user logic }
Cascade operations
The HasCascadeOperation trait lets a model keep its relations in sync with role changes:
use Mortezamasumi\FbUser\Traits\HasCascadeOperation; class Student extends Model { use HasCascadeOperation; }
$user->cascadeUpdate(['student' => 'student']); // delete/restore relations by role $user->cascadeDelete(['student']); // delete relations (with or without role) $user->cascadeRestore(['student' => 'student']); // restore relations and re-assign role
Scheduled cleanup
The RemoveUnAttendUsers job runs hourly and deletes users inactive for remove_unattend_user_hours. No extra setup is required once the plugin is registered.
Support policy
| PHP | Laravel |
|---|---|
| 8.3 | 12 |
Testing
composer test
The suite covers the resource pages (list, create, edit, delete, restore, force delete, bulk actions), filtering, import/export and the cascade operations against an in-memory SQLite database.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover a security vulnerability, please review our security policy on how to report it.
Changelog
Please see CHANGELOG for recent changes.
License
The MIT License (MIT). See LICENSE.md for details.