2015-06-22 84 views
1

我正在嘗試爲4.2 laravel準備包,但是當我在包中使用重定向時,第一個元標記出現在屏幕上,然後它將重定向。我該如何解決這個問題?在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'); 
      } 
+0

提問「x,y,z不起作用」的問題必須在問題中有代碼,請添加此代碼或期望降低提示 – Luceos

回答

0

添加illuminate/support爲您包的依賴,那麼你就可以訪問外立面。您可以在班級的頂部輸入Illuminate\Support\Facades\Redirect

+0

沒有區別 –