Problem with my route Route [invoices.obtainproducts] not defined

1

Generate my Controllers, models and views with infyom and everything perfect but when I create a function and I call it with a route in a view it tells me it is not defined

I have in my file web.php the following line

Route::resource('facturas', 'FacturaController');

And in the view I try to call my function obtenerproductos and nothing

I have it implemented so {{ route('facturas.obtenerproductos') }}

the error is as follows:

  

Route [invoices.obtainproducts] not defined. (View:   C: \ xampp \ htdocs \ products_sales2 \ resources \ views \ invoices \ create_venta.blade.php)

    
asked by albertolg89 27.02.2018 в 21:39
source

1 answer

1

The error would be solved simply by adding the name to your route and then calling it from the view.

Route::get('obtenerproducto', 'FacturaController@obtenerproducto');
// agregar nombre
Route::get('obtenerproducto', 'FacturaController@obtenerproducto')
         ->name('facturas.obtenerproductos');//con este llamas en la vista
Route::resource('facturas', 'FacturaController');
  

It is recommended to add the route with the method before the route    resource ,

    
answered by 27.02.2018 / 22:01
source