在laravel包中重定向

时间:2015-06-22 18:49:09

标签: laravel

我正在尝试为4.2 laravel准备包,但是当我在我的包中使用重定向时,屏幕上会出现第一个元标记,然后它将重定向。我该如何解决这个问题呢?

$provider = new PaylineProvider($config['api']);
            $request  = $provider->request($this->amount,
                                           $config['request_url'],
                                           $this->callBackUrl
            );
            if($request > 0 && is_numeric($request)) {
                DB::table(Config::get('payment::table'))->insert(
                    array(
                        'amount'      => $this->amount,
                        'provider'    => $this->provider,
                        'order_id'    => $this->orderId,
                        'authority'   => $request,
                        'description' => $this->description,
                        'updated_at'  => time(),
                        'created_at'  => time()
                    )
                );

                return Redirect::to($config['second_request_url'].$request);
            } else {
                throw new PaylineException($request, 'request');
            }

1 个答案:

答案 0 :(得分:0)

添加illuminate/support作为您的包的依赖项,然后您可以访问Facades。您可以在课程顶部导入Illuminate\Support\Facades\Redirect