I am new to Laravel and i am working on login page in which i want throw error below input tags if login credentials are wrong. I have written some code and everything is working fine but errors are not showing.
Have a look at what I have done.
In Controller:
public function login(Request $req) {
$email = $req->input('email');
$password = $req->input('password');
$checkLogin = DB::table('admin')->where(['email'=>$email,'password'=>$password])->get();
if(count($checkLogin) > 0) {
echo "Login Successfull";
}
else {
// echo "Login Failed!";
return Redirect::route('admin-login')->with();
}
}
In View:
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
In Route:
Route::post('admin-login-result','AdminLoginController@login')->name('admin-log');
Thanks