[英]Getting error Route not defined at LARAVEL
I installed a Git laravel (employee-mgmt-laravel5.4-adminlte) 我安装了一个Git laravel(employee-mgmt-laravel5.4-adminlte)
Now I'm trying to export an invoice to excel but the route doesn't work and I'm getting this error : Route [facture-management.export] not defined. 现在,我试图将发票导出到excel,但是路由不起作用,并且出现此错误:路由[facture-management.export]未定义。
This my button 这是我的按钮
<a class="btn btn-primary" href="{{ route('facture-management.create') }}">Ajouter factures</a> (this one work)
<a class="btn btn-primary" href="{{ route('facture-management.export') }}">excel</a> (this one is not working)
This is my route 这是我的路线
Route::resource('facture-management', 'FactureManagementController');
Route::post('facture-management/search', 'FactureManagementController@search')->name('facture-management.search');
What is going wrong because .create and .update are working but why is .excel not working ? 发生了什么问题,因为.create和.update在起作用,但是.excel为什么不起作用?
In your FactureManagementController you should have an export method. 在FactureManagementController中,您应该有一个导出方法。
and then: Route::get('your-url', 'FactureManagementController@export'); 然后:Route :: get('your-url','FactureManagementController @ export');
Because you have a resource route, you have the index/create/show/edit/update/destroy methods, but export you have to create. 因为您具有资源路由,所以具有index / create / show / edit / edit / update / destroy方法,但是必须创建export。
If you do have it defined, please post your controller. 如果确实有定义,请发布您的控制器。
I can see that you are using a laravel controller resource. 我可以看到您正在使用laravel控制器资源。 Laravel controller resource comes with the create and update function by default.
Laravel控制器资源默认带有创建和更新功能。 You are getting this error because facture-management@export is not defined in your controller.
您收到此错误是因为在控制器中未定义facture-management @ export。 Check your facture-management controller and see if public function export() exists.
检查您的采购管理控制器,看看是否存在公共函数export()。 If not, you need to create one and define its functions.
如果没有,则需要创建一个并定义其功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.