2014-06-23 6 views
0

유효성 검사 규칙이 성공한 후 Comments :: create .. 함수를 읽을 수 있지만 내 문제는 Comments::create(); 이후에 더 이상 리디렉션을 읽지 않습니다. 그것은 오류를 표시하지 않습니다하지만 유효성 검사 후 리디렉션하지 않음

이 모든 코드

WatchController라는 이름의 클래스로 묶여 및 방법은 다음

$rules = Validator::make(
    array('comment[comments]' => $data['comments']), 
    array('comment[comments]' => 'required') 
); 

// My textbox 
<input type="text" name="comment[comments]" value="<?php echo $video->id ?>"> 

store을 내 코드는 다음 유효성 검사를 통과하면 인이 있어야합니다라는 이름의 리디렉션하지 않습니다/비디오로 리디렉션/1

if($rules->passes()) 
{ 
    Comments::create($data); 
    Redirect::to('/videos/watch/1')->with('_comment', '<div class="alert alert-success">Successfully added comment.</div>'); 
} 

당신이 그것을보고 싶은 경우에 당신이 내 길을 보여 단지 것 봐.

Route::post('/watch/add_comment', [ 
    'uses'  => '[email protected]' 
]); 

답변

0

당신은 그것을 반환해야합니다.

return Redirect::to('/videos/watch/1')->with('_comment', '<div class="alert alert-success">Successfully added comment.</div>'); 
+0

오 세상에 .. 내가 알지 못했습니다. 문제가 해결되었습니다 .. 선생님, 감사합니다. – eaponz

+0

괜찮습니다. – user3158900

관련 문제