jeudi 18 octobre 2018

Laravel - How to properly route a button to a controller function?

So I have a button that redirects to confirmDelete route:

<td align="center"><button type="button" data-href="" class="btn btn-xs btn-success">Confirm Delete</button></td>

I also set up the route in web.php:

Route::match(['get', 'post'], 'head/sale/h_2_101/confirmDelete/{id}', 'head\sale\h_2_101@confirmDelete')->name("head.sale.h_2_101@confirmDelete")->middleware('auth');

It redirects to this function inside h_2_101.php Controller:

public function comfirmDelete($id) {
    View::share('deleteUrl', route('head.sale.h_2_101@delete', ['id' => $id]));
    View::share('backUrl', "javascript:history.back()");

    return redirect()->back()->withInput();
}

But when I press on the Confirm Delete button, it gives me this error:

enter image description here

Is there something I missed?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire