重定向到 laravel 中未重定向的路由

Redirect to route not redirecting in laravel

我一直在使用 Laravel-5.8.35。我正在通过表单调用 GET 请求。在我的路线上,我将 form 操作重定向到提交表单的相同 controller,但通过不同的路线重定向,如

$router->get('/merchant/sd-refund', 'Reports\ReportController@refundSecurityDeposit');

并且,在我的 refundSecurityDeposit 方法中,我调用了我的 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 服务已完成处理,但我想将路由重定向到另一条路由,因为,

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-refund?... 上,其中 form 最初被提交。我重定向了这样的另一个服务,但它工作正常。谁能建议我在这里实施的错误? TIA.

您需要return退还保证金功能

public function refundSecurityDeposit(Request $request)
{

   return $this->execRefundRequest($userId, $reason, $sdAmount);
}