PHP Class Laravel\Cashier\Subscription

Inheritance: extends Illuminate\Database\Eloquent\Model
Afficher le fichier Open project: laravel/cashier-braintree Class Usage Examples

Protected Properties

Свойство Type Description
$dates array The attributes that should be mutated to dates.
$guarded array The attributes that aren't mass assignable.

Méthodes publiques

Méthode Description
active ( ) : boolean Determine if the subscription is active.
applyCoupon ( $coupon, $removeOthers = false ) * Apply a coupon to the subscription.
asBraintreeSubscription ( ) : Braintree\Subscription Get the subscription as a Braintree subscription object.
cancel ( ) Cancel the subscription.
cancelNow ( ) Cancel the subscription immediately.
cancelled ( ) : boolean Determine if the subscription is no longer active.
markAsCancelled ( ) : void Mark the subscription as cancelled.
onGracePeriod ( ) : boolean Determine if the subscription is within its grace period after cancellation.
onTrial ( ) : boolean Determine if the subscription is within its trial period.
resume ( ) Resume the cancelled subscription.
swap ( string $plan ) Swap the subscription to a new Braintree plan.
user ( ) Get the user that owns the subscription.
valid ( ) : boolean Determine if the subscription is active, on trial, or within its grace period.

Méthodes protégées

Méthode Description
currentDiscounts ( ) : array Get the current discounts for the subscription.
getDiscountForSwitchToMonthly ( BraintreePlan $currentPlan, BraintreePlan $plan ) : object Get the discount to apply when switching to a monthly plan.
getDiscountForSwitchToYearly ( ) : object Get the discount to apply when switching to a yearly plan.
moneyRemainingOnYearlyPlan ( BraintreePlan $plan ) : float Calculate the amount of discount to apply to a swap to monthly billing.
swapAcrossFrequencies ( string $plan ) Swap the subscription to a new Braintree plan with a different frequency.
switchingToMonthlyPlan ( BraintreePlan $currentPlan, BraintreePlan $plan ) : boolean Determine if the user is switching form yearly to monthly billing.
wouldChangeBillingFrequency ( string $plan ) : boolean Determine if the given plan would alter the billing frequency.

Method Details

active() public méthode

Determine if the subscription is active.
public active ( ) : boolean
Résultat boolean

applyCoupon() public méthode

* Apply a coupon to the subscription.
public applyCoupon ( $coupon, $removeOthers = false )
$coupon
$removeOthers

asBraintreeSubscription() public méthode

Get the subscription as a Braintree subscription object.
public asBraintreeSubscription ( ) : Braintree\Subscription
Résultat Braintree\Subscription

cancel() public méthode

Cancel the subscription.
public cancel ( )

cancelNow() public méthode

Cancel the subscription immediately.
public cancelNow ( )

cancelled() public méthode

Determine if the subscription is no longer active.
public cancelled ( ) : boolean
Résultat boolean

currentDiscounts() protected méthode

Get the current discounts for the subscription.
protected currentDiscounts ( ) : array
Résultat array

getDiscountForSwitchToMonthly() protected méthode

Get the discount to apply when switching to a monthly plan.
protected getDiscountForSwitchToMonthly ( BraintreePlan $currentPlan, BraintreePlan $plan ) : object
$currentPlan BraintreePlan
$plan BraintreePlan
Résultat object

getDiscountForSwitchToYearly() protected méthode

Get the discount to apply when switching to a yearly plan.
protected getDiscountForSwitchToYearly ( ) : object
Résultat object

markAsCancelled() public méthode

Mark the subscription as cancelled.
public markAsCancelled ( ) : void
Résultat void

moneyRemainingOnYearlyPlan() protected méthode

Calculate the amount of discount to apply to a swap to monthly billing.
protected moneyRemainingOnYearlyPlan ( BraintreePlan $plan ) : float
$plan BraintreePlan
Résultat float

onGracePeriod() public méthode

Determine if the subscription is within its grace period after cancellation.
public onGracePeriod ( ) : boolean
Résultat boolean

onTrial() public méthode

Determine if the subscription is within its trial period.
public onTrial ( ) : boolean
Résultat boolean

resume() public méthode

Resume the cancelled subscription.
public resume ( )

swap() public méthode

Swap the subscription to a new Braintree plan.
public swap ( string $plan )
$plan string

swapAcrossFrequencies() protected méthode

Swap the subscription to a new Braintree plan with a different frequency.
protected swapAcrossFrequencies ( string $plan )
$plan string

switchingToMonthlyPlan() protected méthode

Determine if the user is switching form yearly to monthly billing.
protected switchingToMonthlyPlan ( BraintreePlan $currentPlan, BraintreePlan $plan ) : boolean
$currentPlan BraintreePlan
$plan BraintreePlan
Résultat boolean

user() public méthode

Get the user that owns the subscription.
public user ( )

valid() public méthode

Determine if the subscription is active, on trial, or within its grace period.
public valid ( ) : boolean
Résultat boolean

wouldChangeBillingFrequency() protected méthode

Determine if the given plan would alter the billing frequency.
protected wouldChangeBillingFrequency ( string $plan ) : boolean
$plan string
Résultat boolean

Property Details

$dates protected_oe property

The attributes that should be mutated to dates.
protected array $dates
Résultat array

$guarded protected_oe property

The attributes that aren't mass assignable.
protected array $guarded
Résultat array