public function subscribe(Request $request)
    {
        $this->validate($request, [
            'plan' => 'required',
            'terms' => 'required|accepted',
            'stripe_token' => 'required',
        ]);

        $plan = Spark::plans()->find($request->plan);

        $stripeCustomer = Auth::user()->stripe_id
                ? Auth::user()->subscription()->getStripeCustomer() : null;

        Auth::user()->subscription($request->plan)
                ->skipTrial()
                ->create($request->stripe_token, [
                    'email' => Auth::user()->email
                ], $stripeCustomer);

        event(new Subscribed(Auth::user()));

        return $this->users->getCurrentUser();
    }
public function subscribe(Request $request)
    {
        $this->validate($request, [
            'plan' => 'required',
            'terms' => 'required|accepted',
            'stripe_token' => 'required',
        ]);

        $plan = Spark::plans()->find($request->plan);

        $stripeCustomer = Auth::user()->stripe_id
                ? Auth::user()->subscription()->getStripeCustomer() : null;

        Auth::user()->subscription($request->plan)
                ->skipTrial()
                ->create($request->stripe_token, [
                    'email' => Auth::user()->email
                ], $stripeCustomer);

        event(new Subscribed(Auth::user()));

        return $this->users->getCurrentUser();
    }
public function subscribe ( Request $ request ) { $ this -> validate ( $ request , [ 'plan' => 'required' , 'terms' => 'required|accepted' , 'stripe_token' => 'required' , ] ) ; $ plan = Spark :: plans ( ) -> find ( $ request -> plan ) ; $ stripeCustomer = Auth :: user ( ) -> stripe_id ? Auth :: user ( ) -> subscription ( ) -> getStripeCustomer ( ) : null ; Auth :: user ( ) -> subscription ( $ request -> plan ) -> skipTrial ( ) -> create ( $ request -> stripe_token , [ 'email' => Auth :: user ( ) -> email ] , $ stripeCustomer ) ; event ( new Subscribed ( Auth :: user ( ) ) ) ; return $ this -> users -> getCurrentUser ( ) ; }
Subscribe the user to a new plan.

@param  \Illuminate\Http\Request  $request
@return \Illuminate\Http\Response
Subscribe the user to a new plan .