Your Tab link should be like below :
if /auth is route for your page then
for login tab : /auth#login
=> this will display login tab
for register tab : /auth#register
=> this will display register tab
<ul class="nav nav-tabs tab-nav-right" role="tablist">
<li role="presentation" class="active"><a href="#login" data-toggle="tab"></a></li>
<li role="presentation"><a href="#register" data-toggle="tab"></a</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="login">
<b>Login Form</b>
@if (Request::path()=='auth#login' && count($errors) > 0)
@foreach ($errors->all() as $error)
<p class="alert alert-danger alert-dismissible fade show" role="alert">{{ $error }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</p>
@endforeach
@endif
</div>
<div role="tabpanel" class="tab-pane fade" id="register">
<b>Register Form</b>
@if (Request::path()=='auth#register' && count($errors) > 0)
@foreach ($errors->all() as $error)
<p class="alert alert-danger alert-dismissible fade show" role="alert">{{ $error }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</p>
@endforeach
@endif
</div>
in your controller for login tab error:
if ($validator->fails()) {
return redirect('/auth#login')
->withErrors($validator, 'login')
->withInput();
}
in your controller for register tab error:
if ($validator->fails()) {
return redirect('/auth#register')
->withErrors($validator, 'register')
->withInput();
}
protected $errorBag = 'login';
– Probst