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).

Model reference

An index of every model, enum and value object the package ships: which table each model lives in, its relations, and the page that documents it. Use it to look a class up; the behaviour is on the linked page, and the columns are in Database schema.

Conventions

Every model extends Models\BaseModel, unless the table says otherwise. The base class gives each model three things:

Every concrete model is registered in Laravel's morph map under a larsasub_* alias (larsasub_billable, larsasub_recurring_charge, …), so class names never end up in morph columns and a host using Relation::enforceMorphMap() needs no entries for them. An alias you define yourself for a package model wins; the package then skips its own for that class.

Models are public API, columns included — see Public API. All model classes live under Models\, except the three Mollie models under PaymentProviders\Mollie\Models\.

Core billing

The registration, the plans and each subscriber's instance of a plan.

Model Table Relations Documented in
Billable larsasub_billables owner(), tenant(), subscriptions(), recurringCharges(), singlePayments(), credit(), creditTransactions(), mollieCustomers(), dunningCases(), notificationDeliveries() Billable models
Subscription larsasub_subscriptions tenant(), changeTargets() Subscriptions
BillableSubscription larsasub_billable_subscriptions billable(), subscription(), vatPlan() (the plan, also soft-deleted, for the VAT rate and the features), paymentMethod(), providerMandate(), recurringCharges(), paidRecurringCharges(), unpaidRecurringCharges(), plannedRecurringCharges(), pendingRecurringCharges(), costLines() Subscriptions
SubscriptionCostLine larsasub_subscription_cost_lines billableSubscription() Cost lines

larsasub_subscription_change_targets is a pivot table with no model of its own; it backs Subscription::changeTargets().

Payments

Charges, one-time payments, the payment methods they run on, reminder series and payouts.

Model Table Relations Documented in
RecurringCharge larsasub_recurring_charges billable(), paymentMethod(), invoice(), settlement(), billableSubscription(), providerMandate(), supersededBy(), supersededCharges(), followsCharge(), followUps(), dunningCase(), creditTransactions() Recurring charges
SinglePayment larsasub_single_payments billable(), paymentMethod(), invoice(), settlement(), paymentEntities(), lines() Single payments
SinglePaymentEntity larsasub_single_payment_entities singlePayment(), entity() Single payments
SinglePaymentLine larsasub_single_payment_lines singlePayment() Single payments
PaymentMethod larsasub_payment_methods firstPaymentMethod(), tenantPaymentMethods() Payment methods
TenantPaymentMethod larsasub_tenant_payment_methods tenant(), paymentMethod() Payment methods
DunningCase larsasub_dunning_cases charge(), billable(), steps() Reminder series
DunningStep larsasub_dunning_steps dunningCase() Reminder series
Settlement larsasub_settlements tenant(), recurringCharges(), singlePayments(); payments() returns both as one collection Mollie Connect

RecurringCharge and SinglePayment extend ProviderPaymentModel (see Provider), which supplies their first four relations.

Credit

The credit wallet. Change balances only through CreditService; see Credit.

Model Table Relations Documented in
BillableCredit larsasub_billable_credits billable(), transactions() Credit
CreditTransaction larsasub_credit_transactions billableCredit(), billable(), source(), recurringCharge(), performedBy() Credit

Invoicing

Issued documents and their numbering. Invoices, invoice lines and credit notes are immutable once issued.

Model Table Relations Documented in
Invoice larsasub_invoices billable(), invoiceable(), tenant(), lines(), creditNotes(), creditNote() Invoicing
InvoiceLine larsasub_invoice_lines invoice() Invoicing
CreditNote larsasub_credit_notes invoice(), billable(), tenant() Invoicing
InvoiceSequence larsasub_invoice_sequences tenant() Invoicing

Provider

The provider-neutral base classes and the Mollie models behind them.

Model Table Relations Documented in
ProviderCustomerModel — (abstract) billable(), mandates() Mollie
ProviderMandateModel — (abstract) billable(), paymentMethod(), billableSubscriptions(), recurringCharges() Payment methods
ProviderPaymentModel — (abstract) billable(), paymentMethod(), invoice(), settlement() Base of RecurringCharge and SinglePayment; see Recurring charges
PaymentProviders\Mollie\Models\MollieCustomer larsasub_mollie_customers billable(), tenant(), mandates() Mollie
PaymentProviders\Mollie\Models\MollieMandate larsasub_mollie_mandates billable(), paymentMethod(), mollieCustomer(), billableSubscriptions(), recurringCharges() Mollie
PaymentProviders\Mollie\Models\MollieConnectedAccount larsasub_mollie_connected_accounts tenant() Mollie Connect
ConnectFlowState larsasub_connect_flow_states — Mollie Connect — short-lived OAuth flow state; a row is deleted when its flow completes

MollieCustomer extends ProviderCustomerModel and MollieMandate extends ProviderMandateModel.

Supporting

Evidence, the notification delivery log and the activity history.

Model Table Relations Documented in
TermsAcceptance larsasub_terms_acceptances billable(), billableSubscription() Terms acceptance
NotificationDelivery larsasub_notification_deliveries billable(), recipient() Multi-database tenancy
ModelLog larsasub_model_logs — Traits and helpers

ModelLog is not a LarsaSub class: it is PetersDevelopment\ModelLogger\ModelLog from peters-development/laravel-model-logger. The package creates the larsasub_model_logs table and registers a larsasub log channel that points at it.

Enums

Machine-readable state lives in enums rather than prose columns, so you can match on it. The backed values are stored and travel in events, so they never change meaning. A release may add a case without calling it breaking, so give every match in your code a default arm: an exhaustive match without one throws UnhandledMatchError on the new case. Classes marked internal are not public API, but where their backed values appear in your config or a published view, those values are.

Enum Where it appears Cases
Enums\SubscriptionState BillableSubscription::state() Pending, Upcoming, Active, Ended, Deactivated — lifecycle state
Enums\ActivationSource activation_source on a subscription, and the Activated/Started events first_payment, free, deferred_mandate, change — instance properties
Enums\DeactivationReason deactivation_reason on a subscription Lifecycle
Enums\NotPayableReason RecurringCharge::notPayableReason() Outstanding charges
Enums\MandateSetupStatus $owner->mandateSetupStatus() Mandate setup status
Enums\MandateRemovalBlocker MandateServiceException::$reason, MandateService::removalBlockers() Removing a mandate
Enums\RefundBlocker RefundServiceException::$reason — why RefundService::refund() refused Refusals
Enums\VatTreatment vat_treatment on charges and single payments, ChargeQuote::$treatment The frozen snapshot
Enums\VatNumberStatus vat_check_status on Billable, VatNumberCheckResult::$status, ChargeQuote::$vatNumberStatus, VatNumberCheckedEvent pending, valid, invalid, unavailable — Validating VAT numbers
Enums\VatBasis ChargeQuote::$vatBasis — what a quote's VAT rests on stored, supplied, assumed — The VAT profile
Enums\CollectionNotice CostLineChangeSet::$vatNotice, MonthlyAmountSummary::$vatNotice, ChargeQuote::$collectionNotice — how a listed price relates to the debit gross, reverse-charge, net, or null when they are the same (the default install)
Enums\CostLineChangeType CostLineChange::$type added, changed, ended — Cost-line events
Enums\OrphanBlocker The skipped keys of larsasub:prune-billables --orphaned Orphan blockers
Enums\ValuedFromBlocker The skipped keys of larsasub:backfill-valued-from Valued-from backfill
Enums\SettlementSyncOutcome SettlementSyncResult::$skippedReason and a connected account's settlements_sync_error What a sync outcome means
Enums\DunningStatus, Enums\DunningOrigin, Enums\DunningClosedReason, Enums\DunningPauseReason, Enums\DunningAction, Enums\DunningStepResult, Enums\DunningPruneBlocker The reminder series: DunningCase and DunningStep columns, their events, and the skipped keys of larsasub:prune-dunning-cases One table each in Reminder series
Enums\FreePlanMandate (internal) subscription.free_plan_mandate activate, mandate, refuse — Free plans
Enums\DoublePaidAction (internal) dunning.double_paid refund, credit, signal — Chargeback follow-ups
Enums\AdminAudience (internal) Which administration a company mail's button targets; arrives in the mail layout as $adminAudience platform, tenant — The admin button
Enums\BreakdownEntryType (internal) The type of an amount_breakdown entry and of ChargeQuoteLine::$type Ask ChargeQuoteLine::isSubscription() / isCostLine() instead
Enums\NotificationFunnel, Enums\NotificationDeliveryStatus (internal) The notification delivery log Delivery records

activated_status is display and audit text and is never queried. Key on the enums — deactivation_reason and activation_source — instead.

Common scopes

Every model inherits two scopes from BaseModel:

Model::query()->isNotId($modelOrId)->get();          // exclude one record (a model or an id)
Model::query()->createdMoreThanHoursAgo(24)->get();  // created_at older than 24 hours

Models that carry a billable also get forBillable(Model|int $billable) (from Traits\ScopedToBillable), and tenant-aware models get forTenant(?Model $tenant, bool $includeGlobal = false) (from Traits\ScopedToTenant). See Traits and helpers for the scopes the other traits add.

Value objects

Not models, but part of the public surface: the package returns them, or hands them to your events and hooks. Read their properties by name.

Class What it is Documented in
Support\PaymentRefund One completed refund — id, amount, currency, status, isBookable() Payment value objects
Support\PaymentChargeback One chargeback — id, amount, currency, status, reversedAt, isBookable() Payment value objects
Support\RefundRequest A refund the package asked for — id, status, amount, currency, adopted; never money to book Refunds
Support\CostLineChangeSet Everything one cost-line act changed, plus the settled total per billing period — the payload of SubscriptionCostChangedEvent Cost-line events
Support\CostLineChange One change inside that set — type, key, description, monthlyAmount (the listed amount; the set's monthlyTotal is the debit), previousMonthlyAmount, effectiveOn, announce (what shouldAnnounce() / announceable() filter on) Cost-line events
Support\MonthlyAmountSummary What a subscriber is actually debited per billing period — cost lines, total, introduction total, and the CollectionNotice labelling how that relates to the listed prices. MonthlyAmountSummary::for($billableSubscription) Recurring amount
Support\ChargeQuote, Support\ChargeQuoteLine The answer of SubscriptionCostService::quoteFirstCharge(): the first charge's rows, total and VAT outcome Quoting the first charge
Support\VatProfile The invoice profile you pass to a quote — country, invoiceType, vatNumber The VAT profile
Support\MollieProfile One website profile of a connected Mollie organization — what listProfiles() returns Choosing the website profile
Support\SettlementSyncResult What one settlement sync pass over one account did Settlements
Support\DisconnectImpact, Support\DisconnectFinalizeResult Where a Connect disconnect stands, and what one finalize pass did Disconnecting a tenant
Support\ValuedFromReconstruction The answer of ValuedFromBackfillService::reconstruct() for one cost line Valued-window repair
Support\VatNumberCheck, Support\VatNumberCheckResult The question and answer of a VatNumberValidator Validating VAT numbers
Support\TermsDocument The document a TermsProvider returns Terms acceptance

Two classes you may meet while reading the code are internal: Support\VatSnapshot (the frozen VAT decision behind a charge's vat_* columns — read the columns) and Support\ChargeBreakdownEntry (one amount_breakdown entry).