public function changePlan($plan)
    {
        if (is_numeric($plan)) {
            $plan = App::make(PlanInterface::class)->find($plan);
        }

        // If plans doesn't have the same billing frequency (e.g., interval
        // and interval_count) we will update the billing dates starting
        // today... and sice we are basically creating a new billing cycle,
        // the usage data will be cleared.
        if (is_null($this->plan) or $this->plan->interval !== $plan->interval or
                $this->plan->interval_count !== $plan->interval_count) {
            // Set period
            $this->setNewPeriod($plan->interval, $plan->interval_count);

            // Clear usage data
            $usageManager = new SubscriptionUsageManager($this);
            $usageManager->clear();
        }

        // Attach new plan to subscription
        $this->plan_id = $plan->id;

        return $this;
    }
public function changePlan($plan)
    {
        if (is_numeric($plan)) {
            $plan = App::make(PlanInterface::class)->find($plan);
        }

        // If plans doesn't have the same billing frequency (e.g., interval
        // and interval_count) we will update the billing dates starting
        // today... and sice we are basically creating a new billing cycle,
        // the usage data will be cleared.
        if (is_null($this->plan) or $this->plan->interval !== $plan->interval or
                $this->plan->interval_count !== $plan->interval_count) {
            // Set period
            $this->setNewPeriod($plan->interval, $plan->interval_count);

            // Clear usage data
            $usageManager = new SubscriptionUsageManager($this);
            $usageManager->clear();
        }

        // Attach new plan to subscription
        $this->plan_id = $plan->id;

        return $this;
    }
public function changePlan ( $ plan ) { if ( is_numeric ( $ plan ) ) { $ plan = App :: make ( PlanInterface :: class ) -> find ( $ plan ) ; } // If plans doesn't have the same billing frequency (e.g., interval // and interval_count) we will update the billing dates starting // today... and sice we are basically creating a new billing cycle, // the usage data will be cleared. if ( is_null ( $ this -> plan ) or $ this -> plan -> interval !== $ plan -> interval or $ this -> plan -> interval_count !== $ plan -> interval_count ) { // Set period $ this -> setNewPeriod ( $ plan -> interval , $ plan -> interval_count ) ; // Clear usage data $ usageManager = new SubscriptionUsageManager ( $ this ) ; $ usageManager -> clear ( ) ; } // Attach new plan to subscription $ this -> plan_id = $ plan -> id ; return $ this ; }
Change subscription plan.

@param mixed $plan Plan Id or Plan Model Instance
@return $this
Change subscription plan .