2016-05-12 11 views
0

I "それが正しい方法であるか、または現在、私はこの問題を解決するためにいくつかの他のソリューションを持っているこのコードLaravelクエリ文字列とパラメータを取得しますか?

Route::get('/{report?}/{type?}', [ 
      'uses' => '[email protected]' 
     ])->where(['report' => 'overview', 'type' => 'type1']); 

www.example.com/overview/type1 //Working 
www.example.com?report=overview&type=type1 //Not working (not verifing the where conditions). 

を使用している別の条件パラメータ

ベースのルートを追加するために、私は状況があるlaravalフレームワークを使用してメートル?そこに任意のより良い方法

if (Input::get('report') == 'overview' 
      && Input::get('type') == 'type1') { 
      Route::get('/', [ 
       'uses' => '[email protected]' 
      ]); 
     } 
​ 

答えて

0

これを試してみてください:

if (request()->get('report') == 'overview' 
    && request()->get('type') == 'type1') { 
    Route::get('/', [ 
    'uses' => '[email protected]' 
    ); 
} 
関連する問題