0

I'm trying to pass a variable within a function to the next function which is called but I can an error to say the variable isn't defined.

public function postPayment(Request $request) {

//Fetch package name
$package = $request->input('package');

//Record order
return $this->recordOrder()->with('package', $package);

}

   public function recordOrder($package){

    $stripe_trans = User::where('id', Auth::user()->id)->pluck('stripe_id');

    $order = new Orders;
    $order->user_id = Auth::user()->id;
    $order->order_id = $stripe_trans;
    $order->status = 'Pending';

    $order->save();

    return redirect()->back();
}

1 Answer 1

1

You have to pass the variable while calling the fucntion

return $this->recordOrder($package);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.