如果/auth是页面的路由,则
/auth#login
/auth#register
=>这将显示“寄存器”选项卡
<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>
if ($validator->fails()) {
return redirect('/auth#login')
->withErrors($validator, 'login')
->withInput();
}
在控制器的“注册”选项卡错误中:
if ($validator->fails()) {
return redirect('/auth#register')
->withErrors($validator, 'register')
->withInput();
}