未在laravel

时间:2017-04-12 09:51:00

标签: laravel laravel-5

我收到此错误

  

UrlGenerator.php第304行中的ErrorException:路由[customer.signup]未定义。 (查看:C:\ xampp \ htdocs \ ecomm \ app \ Modules \ Templates \ Resources \ Views \ layouts \ public.blade.php)(查看:C:\ xampp \ htdocs \ ecomm \ app \ Modules \ Templates \ Resources \视图\布局\ public.blade.php)

但据我所知,我的路线都是正确的。 我的public.blade.php

<li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user" aria-hidden="true"></i> User Management <span class="caret"></span>   </a>
    <ul class="dropdown-menu">
        <li><a href="{!! route('customer.signup') !!}">Sign up</a></li>
        <li><a href="#">Login</a></li>
        <li role="separator" class="divider"></li>
        <li><a href="#">Logout</a></li>
    </ul>
</li>

我的路线

Route::get('/shipping-info', [
    'uses' => 'OpenController@shippingInfo',
    'as' => 'cart.shippingInfo'
]);

Route::get('/signup', [
    'uses' => 'OpenController@signup',
    'as' => 'customer.signup'
]);

Route::delete('/product/deleting/{id}', [
    'uses' => 'OpenController@deleting',
    'as' => 'deleting'
]);

Route::get('/login', [
    'uses' => 'OpenController@login',
    'as' => 'client.login'
]);

Route::get('/shopping-cart', [
    'uses' => 'OpenController@shoppingCart',
    'as' => 'cart.shop'
]);

Route::get('/product/update-item/{id}', [
    'uses' => 'OpenController@updateProduct',
    'as' => 'cart.update'
]);

Route::get('/', [
    'uses' => 'OpenController@index',
    'as' => 'index',
]);

Route::get('/{id}', 'OpenController@content');

Route::get('gallery/{title}', 'OpenController@galleryCategory');

Route::get('/product/{id}', [
    'uses' => 'OpenController@product',
    'as' => 'shop.product'
]);

Route::post('/product/update-cart/{id}', [
    'uses' => 'OpenController@updateCart',
    'as' => 'cart.updateCart'
]);

Route::put('/product/update-qty/{id}', [
    'uses' => 'OpenController@newQty',
    'as' => 'new.qty'
]);

我在OpenController中的注册方法

public function signup()
{
    echo "OpenController Signup";
}

1 个答案:

答案 0 :(得分:0)

如果您之前已经运行route:cache,则必须清除路由缓存:

php artisan route:clear