laravel 5.3路线投掷404

时间:2016-11-16 20:04:49

标签: laravel

我在Laravel 5.3中尝试这个并且它不起作用我错过了什么

在routes / web.php

Route::resource('system/suppliers/', 'System\Suppliers\MainController',['names'=>[

    'edit'=>'suppliers.edit',
    'index'=>'suppliers.index',
    'create'=>'suppliers.create',
    'store'=>'suppliers.store',
    'destroy'=>'suppliers.destroy',
    'update'=>'suppliers.update',
    'show'=>'suppliers.show'

]]);

Route::resource('system/suppliers/payments', 'System\Suppliers\PaymentsController',['names'=>[

    'index'=>'suppliers.payments.index',
    'create'=>'suppliers.payments.create',
    'store'=>'suppliers.payments.store',
    'edit'=>'suppliers.payments.edit',
    'destroy'=>'suppliers.payments.destroy',
    'update'=>'suppliers.payments.update',
    'show'=>'suppliers.payments.show'

]]);

当我尝试编辑供应商时,它给了我404 www.myurl.com/system/suppliers/2

我已尝试作为路线组而没有(如上所述)

1 个答案:

答案 0 :(得分:0)

您必须将斜杠“\”替换为“/”

Route::resource('system/suppliers/', 'System/Suppliers/MainController',['names'=>[

    'edit'=>'suppliers.edit',
    'index'=>'suppliers.index',
    'create'=>'suppliers.create',
    'store'=>'suppliers.store',
    'destroy'=>'suppliers.destroy',
    'update'=>'suppliers.update',
    'show'=>'suppliers.show'

]]);