Laravel 6-如何修复到/返回空白页面的路由

问题描述 投票:0回答:1

如果用户从下拉菜单中单击按钮,则我正在路由用户,但它只会将我重定向到空白页面。

下拉菜单中的按钮图片:

enter image description here

空白页的图片:

enter image description here

下拉菜单的代码段:

<li class="nav-item dropdown">
                                <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                                    {{ Auth::user()->first_name }} <span class="caret"></span>
                                </a>

                                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                                    @can('manage-agent')
                                    <a class="dropdown-item" href="{{ route('agent.flightManagement') }}">
                                        <i class="fa fa-plane" aria-hidden="true"></i>
                                        Flight Management
                                    </a>
                                    <a class="dropdown-item" href="#">
                                        <i class="fa fa-book" aria-hidden="true"></i>
                                        Booking Management
                                    </a>
                                    <a class="dropdown-item" href="#">
                                        <i class="fa fa-user" aria-hidden="true"></i>
                                        User Management
                                    </a>
                                    <a class="dropdown-item" href="#">
                                        <i class="fa fa-address-book" aria-hidden="true"></i>
                                        Passenger Management
                                    </a>
                                    <hr>
                                    @endcan
                                    <a class="dropdown-item" href="{{ route('logout') }}"
                                        onclick="event.preventDefault();
                                        document.getElementById('logout-form').submit();">
                                            <i class="fa fa-power-off" aria-hidden="true"></i>
                                        Logout
                                    </a>
                                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                        @csrf
                                    </form>
                                </div>
                            </li>

web.php的代码段:

Route::namespace('Agent')->middleware('can:manage-agent')->group(function(){
    Route::resource('/agent', 'AgentsController');
    Route::get('agent/flightManagement', 'AgentsController@flightManagement')->name('agent.flightManagement');
    Route::post('/agent/store', 'AgentsController@store')->name('agent.store');
});

AgentsController内部的flightManagement函数的代码段:

public function flightManagement()
    {
        return view('agent\flightManagement');
    }

我不知道是什么原因导致了这个问题,因为它只显示一个空白页,即使在浏览器的控制台中也没有错误,但是在laravel.log文件中却显示了这一点:

[[先前的例外] [对象](Symfony \ Component \ Routing \ Exception \ RouteNotFoundException(代码:0):未定义路线[flightManagement]。在C:\ xampp \ htdocs \ ChingChong_Airlines \ vendor \ laravel \ framework \ src \ Illuminate \ Routing \ UrlGenerator.php:420)[stacktrace]

0 C:\ xampp \ htdocs \ ChingChong_Airlines \ vendor \ laravel \ framework \ src \ Illuminate \ Foundation \ helpers.php(782):

Illuminate \ Routing \ UrlGenerator-> route('flightManagemen ...',Array,是)

1 C:\ xampp \ htdocs \ ChingChong_Airlines \ storage \ framework \ views \ 8d22c5f09df43b073d10fd0d1dc7f6aa250603dd.php(73):

route('flightManagemen ...')

php laravel url-routing
1个回答
0
投票

尝试使用其他名称重新创建新视图,例如helpers-working.php

© www.soinside.com 2019 - 2024. All rights reserved.