Laravel 5: how to redirect with data to external resource form controller

前端 未结 3 895
小蘑菇
小蘑菇 2021-02-10 09:27

I want to send user to payment gate. Normally it could be made by this form:

<
3条回答
  •  名媛妹妹
    2021-02-10 09:51

    It could help you use the Laravel controller as usual and redirect after to the external resource.

    In your view redirect the action to your controller:

    
        
        
        
        
        
    
    

    In your controller:

    public function method(Request $request)
    {
         // Validate
         // Store
         // ...
         Redirect::away('https://demo.moneta.ru/assistant.htm')->withInputs(Input::all());
    
    }
    

    I didn't test it, but I'm pretty sure that it works (or is near to the solution).

    You can get other suggestion from the official guide: http://laravel.com/docs/5.1/responses#redirects

提交回复
热议问题