简体   繁体   中英

Getting error Route not defined at LARAVEL

I installed a 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.

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 ?

In your FactureManagementController you should have an export method.

and then: 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.

If you do have it defined, please post your controller.

I can see that you are using a laravel controller resource. Laravel controller resource comes with the create and update function by default. You are getting this error because facture-management@export is not defined in your controller. Check your facture-management controller and see if public function export() exists. If not, you need to create one and define its functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM