I have a website, got it developed from someone, Need help in redirecting back after login in php.
After Login it redirects to Home Page. But i want user to go back where he came from.
logincontroller.php
public function checklogin(Request $request){
$phone = DB::table('users')->where('contact','=',$request->input('code').$request->input('contact'))->get();
if(count($phone)>0){
$user_data = array(
'email' => $phone[0]->email,
'password' => $request->get('password')
);
if(Auth::attempt($user_data)){
return redirect('/');
}else{
return back()->with('error','wrong_details');
}
}else{
return back()->with('error','wrong_details');
}
}