The package ships a reusable PlanSubscriptionsRelationManager you can add to any Filament resource whose model uses HasPlanSubscriptions. It gives you a Subscriptions tab on the resource's edit page with create / cancel / renew / delete inline.
Add it to a resource
use Crumbls\SubscriptionsFilament\RelationManagers\PlanSubscriptionsRelationManager;
class TenantResource extends Resource
{
public static function getRelations(): array
{
return [
PlanSubscriptionsRelationManager::class,
];
}
}
That's the whole integration. Open any tenant in the admin, switch to the Subscriptions tab, and you'll see every plan subscription that tenant holds.
What you get
- List -- all subscriptions for this subscriber, with status badges (Active / Trial / Grace / Canceled / Ended)
- Filter by plan
- Create -- a new subscription with a plan picker
- Cancel -- inline action, immediate cancellation, fires
SubscriptionCanceled - Renew -- inline action on ended subscriptions
- Delete -- soft-delete the subscription
- View -- click through to subscription detail
Works on any subscriber model
The relation manager is fully polymorphic. As long as the resource's model uses the HasPlanSubscriptions trait from crumbls/subscriptions, the relation manager works:
use Crumbls\Subscriptions\Traits\HasPlanSubscriptions;
class Tenant extends Model
{
use HasPlanSubscriptions;
}
class User extends Model
{
use HasPlanSubscriptions;
}
class Team extends Model
{
use HasPlanSubscriptions;
}
Each of TenantResource, UserResource, TeamResource can include PlanSubscriptionsRelationManager::class and they'll all work without modification.
When to use this vs. the standalone Subscriptions resource
| Use case | Pick |
|---|---|
| "Show me everyone's subscriptions" | Standalone Subscriptions resource |
| "Show me this tenant's subscriptions on their tenant detail page" | Drop-in relation manager |
| "Both" | Both -- they don't conflict |
The drop-in relation manager is the right surface for ops / support work where you're looking at one customer at a time. The standalone resource is the right surface for cross-customer reporting and bulk views.
Customization
If you need to change columns, filters, or actions:
use Crumbls\SubscriptionsFilament\RelationManagers\PlanSubscriptionsRelationManager;
class CustomPlanSubscriptionsRelationManager extends PlanSubscriptionsRelationManager
{
public function table(Table $table): Table
{
return parent::table($table)
->actions([
// your custom actions
]);
}
}
Then register your subclass instead of the base in your resource's getRelations().
Contributing
Thanks for your interest in contributing to crumbls/subscriptions-filament.
Local setup
git clone https://github.com/Crumbls/subscriptions-filament.git
cd subscriptions-filament
composer install
To hack on this package alongside the underlying crumbls/subscriptions package, add a path repository to your test app's composer.json:
{
"repositories": [
{ "type": "path", "url": "../subscriptions" },
{ "type": "path", "url": "../subscriptions-filament" }
]
}
Pull requests
- Open the PR against
main. - Breaking changes belong behind a version bump — note them in
CHANGELOG.md. - If the change affects what admins see, include a screenshot or screen recording.
Reporting issues
Open a GitHub issue with:
- Affected version (
composer show crumbls/subscriptions-filament). crumbls/subscriptionsversion.- PHP, Laravel, and Filament versions.
- Steps to reproduce.
- Expected vs. actual behavior.
Security issues
Please do not open public issues for security vulnerabilities. See SECURITY.md for reporting channels.
Contributors
Thank you to everyone who has contributed to this package. Every pull request, bug report, and idea makes a difference.