samedi 28 mai 2016

Pass variable from one function to another inside a single controller

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();
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TLJjE6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire