app/Actions/Billing/GenerateInvoice.php
/**
     * Extends subscription by default based on the existing plan
     * @param $subscription
     * @return mixed
     */
Extends subscription by default based on the existing plan
@param $subscription
@return mixed
Extends subscription by default based on the existing plan @param $subscription @return mixed
public static function extendSubscriptionEndDate($subscription)
    {
        $subscription = Subscription::findOrFail($subscription->id);
        $subscriptionValidity = $subscription->plan->validity;
        self::$commandObject->info(
            "Start and end date of Ongoing subscription " .
                $subscription->start_date .
                " - " .
                $subscription->end_date
        );
        $newStartDate = Carbon::parse($subscription->end_date)->addDays(1);
        $subscription->start_date = $newStartDate;
        $newEndDate = Carbon::parse($subscription->end_date)->addDays(
            $subscriptionValidity
        );
        $subscription->end_date = $newEndDate;
        self::$commandObject->info(
            "Start and end date of extended subscription " .
                $subscription->start_date .
                " - " .
                $subscription->end_date
        );
        $subscription->save();
        self::$commandObject->info(
            "Subscription dates extended in subscriptions table"
        );
        return $subscription;
    }
public static function extendSubscriptionEndDate ( $ subscription ) { $ subscription = Subscription :: findOrFail ( $ subscription -> id ) ; $ subscriptionValidity = $ subscription -> plan -> validity ; self :: $ commandObject -> info ( " Start and end date of Ongoing subscription  " . $ subscription -> start_date . "  -  " . $ subscription -> end_date ) ; $ newStartDate = Carbon :: parse ( $ subscription -> end_date ) -> addDays ( 1 ) ; $ subscription -> start_date = $ newStartDate ; $ newEndDate = Carbon :: parse ( $ subscription -> end_date ) -> addDays ( $ subscriptionValidity ) ; $ subscription -> end_date = $ newEndDate ; self :: $ commandObject -> info ( " Start and end date of extended subscription  " . $ subscription -> start_date . "  -  " . $ subscription -> end_date ) ; $ subscription -> save ( ) ; self :: $ commandObject -> info ( " Subscription dates extended in subscriptions table " ) ; return $ subscription ; }
Extends subscription by default based on the existing plan
 @param $subscription
 @return mixed
Extends subscription by default based on the existing plan @param $subscription @return mixed