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

前端 未结 3 1780
渐次进展
渐次进展 2021-02-10 09:19

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

<
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-10 09:59

    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

提交回复
热议问题