Hello so I am working on my own authentication system using Laravel's lumen and getting the error Call to undefined function App\Http\Controllers\back()
whenever I try to login with wrong credentials. This what my function looks like in my controller:
public function loglink(Request $request) {
$input = $request->all();
$user = array(
'username' => $input['username'],
'password' => $input['password']
);
if (Auth::attempt($user)) {
$user = Auth::user();
return view('auth.welcome', compact('user'));
} else {
return back()->withInput();
}
}
Is there something I need to include/call in my controller?
You can use
back()
shortland in Laravel only for now. For Lumen you need to addredirect()
:Read more: http://lumen.laravel.com/docs/responses#redirects