通過重定向在laravel 5傳遞數據時,我有一些問題,我得到一些樣本代碼..在這裏我的代碼傳遞數據5
控制器
if($validator->fails()){
return redirect()->back()->withErrors($validator->errors())->withInput();
}else{
if (Hash::check($request->old_password, $employee->password)){
$user = [
'username' => $input['username'],
'password' => Hash::make($input['password']),
];
$employee->fill($user)->save();
return redirect('/employees');
}else{
dd('test');
$error = 'Your old password is incorrect';
return redirect()->back()->with('error',$error);
}
}
視圖
<div class="form-group">
<label for="old_password" class="col-sm-2 control-label">Password Lama</label>
<div class="col-sm-5">
<input type="password" class="form-control" name="old_password" placeholder="Password Lama" required />{{ $errors->first('old_password') }}{{ $error = session('error') }}
</div>
</div>
有沒有錯誤信息,但$錯誤不能顯示我的消息..任何人都可以幫助我?
非常感謝......
是否在您的刀片中有'print_r''$ error'? – 2015-04-02 16:15:51
不,我不使用print_r,是這個問題嗎? – 2015-04-03 02:20:20