laravel pass variable parameters on button

0

In the grid of a CRUD, I have a search button in the upper part next to the title. In that button I go to the corresponding method in the controller, but passing the id of the record. I put this:

<a class='btn btn-info' href='{{ route('productos.show',$producto->id) }}' style='text-align:right'>BUSCAR</a>

In the index method of the controller I have this:

$productos=\App\Producto::get();
        return view('productos.index')->with('productos',$productos);

And at web.php this:

Route::get('/',function () {
    return view('productos/index');
});
//rutas para todo el crud
Route::resource('productos','ProductoController');

I get the following error: "Undefined variable: product (View: C: \ xampp \ htdocs \ ad \ dam2d \ resources \ views \ products \ index.blade.php)"

    
asked by Charly Utrilla 08.02.2018 в 17:17
source

0 answers