2016-12-28 7 views
1

私は暗号化していません。私は暗号化しないと、すべてのものがうまくいきます。暗号化されたURLを入れて、ビュー(確認ブレード)に$applicantData変数を送ります。しかし、暗号を追加すると完全に変更されますが、 $applicantData変数を表示するとエラーが表示されます。この問題はどのように解決できますか?私はlaravel 5.2を使用しています。変数laravel 5.2でビューをリダイレクトする方法は?

ルート:

Route::group(['prefix' => 'career'], function() { 
    Route::get('/', ['as' => 'careerHome' , 'uses' => '[email protected]']); 
    Route::get('apply', ['as' => 'addApplicant', 'uses' => '[email protected]']); 
    Route::post('save', ['as' => 'saveApplicant', 'uses' => '[email protected]']); 
    Route::get('confirmation/{id}', ['as' => 'confirmationMsg', 'uses' => '[email protected]']); 
}); 

ApplicantController:リダイレクトのための

$id = $applicant->id; 
$applicantData = Applicant::whereId($id)->first(); 
\Session::flash('flash_message','Application has been successfully submitted.'); 
return redirect()->to('career/confirmation/'.encrypt($id))->withErrors(compact("applicantData")); 
+0

あなたの 'ApplicantController - >公開関数'($ id){decrypt($ id); } '? –

+0

@RobinDirksen No. ApplicantControllerで復号化されません。 –

答えて

1

使用Redirect::to、この方法のようにwithInput()->withErrors(['msg' => "some error happens"]);

return Redirect::to('career/confirmation/'.encrypt($id))->withInput()->withErrors(compact("applicantData")); 

あなたのブレードに次のようなエラーが表示されます:

 <ul class="errors"> 
@foreach ($errors->all() as $message) 
     <li>{{ $message }}</li> 
@endforeach 
     </ul> 
+0

それはエラーを表示する '配列への文字列変換(ビュー:C:\ xampp \ htdocs \ NoticeBoard \ resources \ views \ applicant \ confirmation.blade.php)' –

+0

var_dump(compact( "applicantData")) –

+0

これらのデータを他のブレード(確認ブレード)にどのように表示できますか? –

関連する問題