protected function createSubscriptionOnStripe(Request $request, $user)
    {
        $plan = Spark::plans()->find($request->plan);

        $subscription = $user->subscription($plan->id);

        if ($plan->hasTrial()) {
            $subscription->trialFor(Carbon::now()->addDays($plan->trialDays));
        }

        if ($request->coupon) {
            $subscription->withCoupon($request->coupon);
        }

        $subscription->create($request->stripe_token, [
            'email' => $user->email,
        ]);
    }
protected function createSubscriptionOnStripe(Request $request, $user)
    {
        $plan = Spark::plans()->find($request->plan);

        $subscription = $user->subscription($plan->id);

        if ($plan->hasTrial()) {
            $subscription->trialFor(Carbon::now()->addDays($plan->trialDays));
        }

        if ($request->coupon) {
            $subscription->withCoupon($request->coupon);
        }

        $subscription->create($request->stripe_token, [
            'email' => $user->email,
        ]);
    }
protected function createSubscriptionOnStripe ( Request $ request , $ user ) { $ plan = Spark :: plans ( ) -> find ( $ request -> plan ) ; $ subscription = $ user -> subscription ( $ plan -> id ) ; if ( $ plan -> hasTrial ( ) ) { $ subscription -> trialFor ( Carbon :: now ( ) -> addDays ( $ plan -> trialDays ) ) ; } if ( $ request -> coupon ) { $ subscription -> withCoupon ( $ request -> coupon ) ; } $ subscription -> create ( $ request -> stripe_token , [ 'email' => $ user -> email , ] ) ; }
Create the subscription on Stripe.

@param  \Illuminate\Http\Request  $request
@param  \Illuminate\Contracts\Auth\Authenticatable  $user
@return void
Create the subscription on Stripe .