我已经加密了url。如果我没有加密,那么一切正常。现在我想要加密的URL并将$applicantData
变量发送到视图(确认刀片)。但是如果我添加加密那么它的url会完全改变但是我无法发送$applicantData
变量来查看我的错误。我怎样才能解决这个问题?我正在使用laravel 5.2。
路线:
Route::group(['prefix' => 'career'], function () {
Route::get('/', ['as' => 'careerHome' , 'uses' => 'ApplicantController@index']);
Route::get('apply', ['as' => 'addApplicant', 'uses' => 'ApplicantController@create']);
Route::post('save', ['as' => 'saveApplicant', 'uses' => 'ApplicantController@store']);
Route::get('confirmation/{id}', ['as' => 'confirmationMsg', 'uses' => 'ApplicantController@show']);
});
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 :(得分: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>