LarsaSub is launching soon. Purchases and account registration open shortly.

Documentation for larsasub v0.38.2. On an older version? Your release notes ship with the package (CHANGELOG.md).

Nova integration

Laravel Nova admin resources for LarsaSub ship as a separate package, peters-development/larsasub-nova. Read this page when you run Nova and want to manage plans, subscribers, charges, credit, invoices and the Mollie records from it.

Installation

The companion installs from the same private repository as the core package and is included with every license tier. The core package has no Nova dependency and never will: a host that does not use Nova should not carry it.

composer require peters-development/larsasub-nova

The service provider is auto-discovered and registers the resources whenever Nova is served. Add the LarsaSub section to your Nova menu in NovaServiceProvider::boot():

use Illuminate\Http\Request;
use Laravel\Nova\Nova;
use PetersDevelopment\LarsaSub\Nova\NovaMenu;

Nova::mainMenu(function (Request $request) {
    return [
        // ... your own menu sections
        NovaMenu::section(),                          // or NovaMenu::section('Billing', 'currency-dollar')
    ];
});

The section holds collapsible groups for subscriptions, payments, credit, invoicing (when invoicing is on), the payment provider (Mollie), Mollie Connect (Connect mode, admin-only) and system records.

Requirement Version
PHP ^8.3
Laravel Nova ^4.35 or ^5.0
peters-development/larsasub The same major.minor as the companion (0.38 requires ^0.38)

Releases are paired with the core package: companion 0.38.x belongs to larsasub 0.38. Update the two together.

What it gives you

Nova resources for every LarsaSub model you would administer, with the package's policies applied. Resources register in groups; with the default null a group switches itself on or off from your core configuration, and true or false forces it.

Resources

Group (larsasub-nova.resources.*) Default Resources
core on Plans (Subscription), billables, subscriber subscriptions (all, active, starting, ended), recurring charges, reminder series and their steps, single payments and their order lines, cost lines, payment methods, credit balances, credit transactions, model logs
invoicing when invoicing.enabled is on Invoices, invoice lines, credit notes, invoice sequences
mollie_provider when provider is mollie Mollie customers, Mollie mandates
mollie_connect when connect.enabled is on Connected accounts (admin-only)

In Connect mode the plan resource adds a tenant panel and the application-fee override, payment methods show tenant_usable, and charges and single payments show their platform fee. In simple mode those fields are not there at all.

Actions

Action Resource What it does
Change subscription Subscriber subscriptions BillableSubscriptionService::changeSubscription() to one of the plan's allowed change targets; the unused part of the period becomes credit
Cancel subscription Subscriber subscriptions Cancels, respecting the notice period
Terminate subscription Subscriber subscriptions Ends the subscription at once (a destructive action, authorized as an update)
Move start date Subscriber subscriptions, detail view Moves the start date with its cost lines, only on a subscription that has never been charged
Close series Reminder series, detail view DunningService::close() for the close ability. The series is otherwise read-only; closing it does not change whether the charge can be paid

Feature labels and multilingual content

Two details come back from the core package:

Configuration

Publish the configuration only if you want to change it:

php artisan vendor:publish --tag=larsasub-nova-config
// config/larsasub-nova.php
return [
    // The Nova resource of your billable owner model; links the "performed by"
    // field on credit transactions.
    'billable_resource' => \App\Nova\User::class,

    'resources' => [
        'core' => true,
        'invoicing' => null,        // null = follow invoicing.enabled
        'mollie_provider' => null,  // null = on when Mollie is the provider
        'mollie_connect' => null,   // null = follow connect.enabled
    ],

    'notifications' => [
        'enabled' => true,
        'connection' => null,       // where nova_notifications lives; null = database.default
        'subscription_events' => true,
        'recurring_charge_events' => true,
        'single_payment_events' => true,
        'credit_events' => true,
        'attention_events' => true,
    ],
];

If your billable owner is not User (a Company, say), point billable_resource at its Nova resource.

Bell notifications

With larsasub-nova.notifications.enabled on, the companion listens to the core package's domain events and posts Nova bell notifications. Each group can be switched off on its own:

Toggle Events
subscription_events Subscription activated, cancelled, changed
recurring_charge_events Charge failed, canceled, expired, charged back, refunded (not a failed first payment)
single_payment_events Single payment paid, failed, charged back, refunded
attention_events A payment needs attention
credit_events Credit added

They go to the platform's own recipients only: the users behind larsasub.notifications.sales, never a tenant's admins. A bell notification lives in this Nova panel and links into it, so it is for the people who administer the panel. A sales address without a user account gets LarsaSub's company mail by mail only, and no bell notification: there is no model to store it against. larsasub:doctor names such an address when a company channel list holds no mail.

These notifications come from the companion's own event subscriber, not from larsasub.notification_channels. Adding Nova's channel there does nothing: no LarsaSub notification implements toNova(), and ConfigurableNotificationChannels drops a channel whose method is missing.

Authorization

The resources and actions use LarsaSub's model policies, configured under larsasub.policies.* (Policies). With the default policy configuration, plans, payment methods, reminder series, model logs and Mollie customers are admin-only, and changing a charge or a subscription requires an admin. Who is an admin is larsasub.policies.admin_role: empty means nobody.

The policies apply the same way in Nova as anywhere else.

Connect mode and per-tenant databases

Not using Nova?

The Filament companion gives a Filament panel the plans, subscriptions, charges, reminder series and payment methods. Without either admin panel, the bundled management dashboards cover plans, subscribers, charges and invoices: in Connect mode as the tenant owner's view, in simple mode as operator management through larsasub.policies.admin_role.