Pass a Variable Controller to the View and how to use it

0

I have a question about how to pass the Variable $ info_pago of a controller to be used in the checkout view and how to work on it.

$info_pago = [
      'merchantId' => "508029",
      'accountId' =>'512321',
      'description' => 'Online Store',
      'referenceCode' => $reference_code,
      'amount' => Cart::total(),
      'signature'=> md5($api_key."~"."508029"."~"."XXXX01"."~". Cart::total() )
  ];

  return view('checkout', ['info_pago' => $info_pago ]);

I do not know how to use it for a form, I thought something like this ..

<input name="merchantId"    type="hidden"  value="{{ request()->merchantId }}" >
              <input name="accountId"     type="hidden"  value="{{ $info_pago->accountId }}" >
              <input name="description"   type="hidden"  value="{{ $info_pago->description }}" >
              <input name="referenceCode" type="hidden"  value="{{ $info_pago->referenceCode}}" >
              <input name="amount"        type="hidden"  value="{{ $info_pago->amount }}"   >

I appreciate the clarification ..

    
asked by Richard Camilo Saavedra Coneo 11.10.2018 в 06:14
source

1 answer

0

To pass a controller variable to the view, just put the following:

return View::make('checkout')->with('info_pago', $info_pago);

Where checkout is the view, 'info_pago' the name with which you will call it in the view and $info_pago the variable that you want to pass.

To show it in the view, it is done the way you show in your question:

 <p>{{ $info_pago->accountId }}</p>
    
answered by 11.10.2018 в 09:21