Php 重定向到在laravel中不重定向的路由
我一直在使用Php 重定向到在laravel中不重定向的路由,php,laravel,routes,Php,Laravel,Routes,我一直在使用Laravel-5.8.35。我通过表单调用了一个GET请求。在我的路线上,我将表单操作重定向到同一控制器,在该控制器中提交表单,但通过不同的路线重定向,如下所示: $router->get('/merchant/sd-refund', 'Reports\ReportController@refundSecurityDeposit'); class SohojSdRefundService { public function __construct() {
Laravel-5.8.35
。我通过表单调用了一个GET
请求。在我的路线上,我将表单
操作重定向到同一控制器
,在该控制器中提交表单,但通过不同的路线重定向,如下所示:
$router->get('/merchant/sd-refund', 'Reports\ReportController@refundSecurityDeposit');
class SohojSdRefundService
{
public function __construct()
{
}
public static function callSdRefundApi($requestData)
{
// call to other methods inside the class to handle the API response,
// and then return to the same route which isn't working
return redirect('/admin/merchant/list');
}
}
在我的returnSecurityDeposit
方法中,我调用了我的SohojSdRefundService
服务
public function refundSecurityDeposit(Request $request)
{
// $userId, $reason, $sdAmount was fetched from the $request instance
$this->execRefundRequest($userId, $reason, $sdAmount);
}
public function execRefundRequest($userId, $reason, $sdAmount)
{
// here the API service request data was handled,
// and stored in $data instance
return SohojSdRefundService::callSdRefundApi($data);
}
当我的SohojSdRefundService
服务完成处理时,我想将路由重定向到另一个路由,如下所示:
$router->get('/merchant/sd-refund', 'Reports\ReportController@refundSecurityDeposit');
class SohojSdRefundService
{
public function __construct()
{
}
public static function callSdRefundApi($requestData)
{
// call to other methods inside the class to handle the API response,
// and then return to the same route which isn't working
return redirect('/admin/merchant/list');
}
}
分别地,该页面没有重定向到该路线,而是恰好位于最初提交
表单的/merchant/sd return?..
上。我重新定向了另一个类似这样的服务,但效果很好。有人能告诉我我在这里可能犯了什么错误吗?TIA。您需要在退款保证金功能中返回结果
public function refundSecurityDeposit(Request $request)
{
return $this->execRefundRequest($userId, $reason, $sdAmount);
}