php - Pass variable from one function to another inside a single controller -
i'm trying pass variable within function next function called can error 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(); }
you have pass variable while calling fucntion
return $this->recordorder($package);
Comments
Post a Comment