jeffersongoncalves/teamkitv5
TeamKit v5 is a Laravel package for adding team management to your application, with tools for teams, memberships, roles, and invitations to help you build multi-user, team-based features faster.
TeamKit v5 is a Laravel + Filament starter kit for apps that need multi-tenancy with a split user panel and admin panel. As of 5.9.0 it tracks Filament v5.9.0 and delegates the User/Admin models, resources and login screens to companion packages rather than shipping them inline — so the first thing to understand is which code lives in this repo vs. in jeffersongoncalves/* dependencies.
Minimal path:
composer require jeffersongoncalves/teamkitv5), then run the published migrations and seeder. The seeder is what creates your first admin user — run it before trying to log in, or you'll get a 403 on /admin with no obvious error.app/Providers/Filament/AdminPanelProvider.php and the user panel provider — panel IDs, paths, and ->tenant() config.Two panels, one codebase. Treat the admin and user panels as separate applications sharing models. Register resources per panel (AdminPanelProvider for oversight, user panel for tenant-scoped CRUD) rather than gating one resource with canAccess(). This keeps navigation clean and avoids leaking admin-only pages into tenant context.
Tenancy is the core abstraction. Resources that belong to a team should implement Filament's tenant-aware interfaces and rely on Filament::getTenant() for scoping. The reliable pattern:
team_id on create.Extend, don't edit vendor code. Since 5.9.0 the User/Admin models, resources and login pages come from packages. Subclass them in app/ and register the subclass (via panel ->login(YourLogin::class), ->model(), or the package's config swap) so composer update doesn't wipe your customisations. If you edited those files directly on 5.8.x, that work needs migrating into subclasses now.
Invitations / membership flow. Typical workflow: admin creates team → invites by email → invited user registers via the user panel → membership pivot row created with a role. Keep invitation acceptance in a dedicated action or controller, not inside the registration form, so you can reuse it for "add existing user to team".
Roles and access. Drive panel access from a single policy/canAccessPanel() implementation keyed off role, and reuse it in resource canViewAny()/canDelete() checks. One source of truth prevents the classic "user can see the button but the action 403s" mismatch.
Composition over a fork. For per-project behaviour, prefer Filament's hooks (->navigationGroups(), custom pages, Resource::getEloquentQuery() overrides in subclasses) plus small service classes. This package is a scaffold — most teams end up owning the resources within a few sprints.
Testing. The repo standardised its CI around a tests workflow in this release; mirror that locally with Pest/PHPUnit feature tests using actingAs($user) plus Filament::setTenant($team). Test both panels — the tenancy boundary is where regressions hide.
app/Models/User.php, admin/user resources, and login pages against the packages, then move your changes into subclasses or a local override. Upgrade on a branch, not on main.composer.json (and any custom panel theme) must support v5. Mixed v4/v5 packages produce confusing "class not found" or "method does not exist" errors at panel boot, not at install time.php artisan filament:clear-cached-components, php artisan optimize:clear, and re-run php artisan filament:assets. Component caching will happily serve the old (now vendor-provided) resource classes.users table from a previous install, publishing the new package migrations can collide. Read each migration before running; prefer new dated migrations over editing existing ones.canAccessPanel() and the role column before assuming the login route is broken.team_id not auto-filled because the resource's mutateFormDataBeforeCreate() wasn't overridden. Verify by creating a record as a non-super-admin in a second team./admin and user panel slugs can clash with your app's existing routes; set explicit ->path() values and check php artisan route:list | grep -i admin.php artisan about confirms the resolved Filament version; php artisan filament:optimize vs optimize:clear distinguishes "works in dev, breaks in prod" cache issues.vendor/ or relying on the demo seeder data in production.How can I help you explore Laravel packages today?