2016-07-12 2 views
0

확인하시기 바랍니다 (특히() 부분을 반환 리디렉션) 대시 보드를 열려면 다음과 같이누락 된 매개 변수 - 아래 단계가 올바른지 Laravel

경로 "Dashboard2는"2 개 변수를 기대하고있다 getDashboard 기능을 통해 볼 :

보기 코드 :

0을 다음과 같이
Route::get('/dashboard2/{wordsRowB}/{wordsRowId}', [  
    'uses' => '[email protected]', 
    'as' => 'dashboard2', 
    'middleware' => 'auth' 

]); 

그래서 내가 이러한 두 변수를 전달
<a href="{{ route('post.pin', [      
          'wordsRowId' => $wordsRowId, 
          'wordsRowB' => $wordsRowB 
         ]) }}">Test</a> 

컨트롤러 코드 :

(나는 명확성을 위해 위의 코드에서 제거 것을, 당신은 오류의 2 개 이상의 변수를 찾을 수 있습니다) :

public function postPin($wordsRowId,$wordsRowB) 
    { 

     return redirect()->route('dashboard2') 
     ->with(['wordsRowId' => $wordsRowId]) 
     ->with(['wordsRowB' => $wordsRowB]); 

내가이 오류를 받고 있어요

Missing required parameters for [Route: dashboard2] [URI: dashboard2/{wordsRowB}/{wordsRowId}]. in UrlGenerationException.php line 17 at UrlGenerationException::forMissingParameters(object(Route)) in UrlGenerator.php line 332 at UrlGenerator->toRoute(object(Route), array(), true) in UrlGenerator.php line 304 at UrlGenerator->route('dashboard2', array()) in Redirector.php line 157 at Redirector->route('dashboard2') in DashController.php line 323 at DashController->postPin('62', '1', '39', 'kokowawa') at call_user_func_array(array(object(DashController), 'postPin'), array('post_id' => '62', 'user_id' => '1', 'wordsRowB' => '39', 'wordsRowId' => 'kokowawa')) in Controller.php line 80 

var_dump를 사용하면 변수가 postPin 함수에 전달된다는 것을 알 수 있지만 성공적으로 리디렉션되었는지 확인하는 방법을 알지 못합니다. 그 길로?

답변

1

나는 당신의 변수는 경로() (

시도 반환 리디렉션 전화) 내에서 할 필요가 있다고 생각 -> 경로 ('dashboard2'[$ wordsRowId, $ wordsRowB]);

+0

배열 구문이 작동했습니다. 감사 –

관련 문제