我正在使用laravel 5.1并且路线类似于:
body {
background: #f1f1f1;
}
ul {
height: 100px;
position: relative;
background: #fff;
}
ul li {
display: block;
float: left;
margin: 0;
list-style-type: none;
padding: 0;
}
ul li a {
display: block;
height: 100px;
line-height: 100px;
padding: 0 20px;
}
ul li ul {
position: absolute;
left: 0px;
right: 0px;
top: 100px;
height: 0px;
visibility: hidden;
animation: hideDropdown 1s;
animation-delay: 0.5s;
animation-fill-mode: backwards;
}
ul li ul li {
position: absolute;
left: 50px;
bottom: 0px;
width: 200px;
overflow: hidden;
height: 100px;
}
ul li ul li a {
display: block;
height: 100px;
background: red;
padding: 0 20px;
position: absolute;
opacity: 0;
transform: translate(0px, 100px);
animation: hideDropdownItem 1s 0.2s;
animation-fill-mode: backwards;
}
ul li ul li:first-child a {
animation-delay: 0.4s;
}
ul li ul li:last-child {
left: 250px;
}
ul li ul li:last-child a {
animation-delay: 0.2s;
}
ul li:hover ul {
animation: showDropdown 1s forwards;
animation-delay: 0s;
}
ul li:hover ul li a {
animation: showDropdownItem 1s forwards 0.2s;
}
ul li:hover ul li:last-child a {
animation-delay: 0.4s;
}
@keyframes showDropdown {
from {
opacity: 0;
height: 0;
visibility: hidden;
}
to {
height: 100px;
opacity: 1;
visibility: visible;
}
}
@keyframes hideDropdown {
from {
height: 100px;
opacity: 1;
visibility: visible;
}
to {
opacity: 0;
height: 0;
visibility: hidden;
}
}
@keyframes showDropdownItem {
from {
opacity: 0;
transform: translate(0px, 100px);
}
to {
opacity: 1;
transform: translate(0px, 0px);
}
}
@keyframes hideDropdownItem {
from {
opacity: 1;
transform: translate(0px, 0px);
}
to {
opacity: 0;
transform: translate(0px, 100px);
}
}
我遇到的问题是,当有人访问此页面时(未登录时),他们会被重定向到登录,这很好,但随后重定向到 AuthController.php中的<ul>
<li>
<a href="#">Dropdown</a>
<ul>
<li><a href="">First</a>
</li>
<li><a href="">second</a>
</li>
</ul>
</li>
<li><a href="">Not dropdown</a>
</li>
</ul>
设置< / em>的。我希望将它们重定向回审阅页面。
提前致谢。
答案 0 :(得分:0)
预期的重定向功能会将用户重定向到他们在被身份验证过滤器捕获之前尝试访问的URL。如果预期目的地不可用,则可以为该方法提供回退URI。 https://laravel.com/docs/5.1/authentication#authenticating-users
return redirect()->intended('dashboard');
我想我发现问题路由{id} / write-review必须在网络中间件
下 Route::group(['middleware' => ['web']], function () {
Route::get('login', 'Auth\AuthController@getLogin');
Route::post('login', 'Auth\AuthController@postLogin');
Route::get('logout', 'Auth\AuthController@getLogout');
Route::group(['middleware' => ['auth']], function () {
Route::get('/{id}/write-review', ['uses' => 'ItemController@writeReview']);
});
});