mardi 21 août 2018

Laravel - route("resource.destroy") calls "resource.show"

This is the web.php

Route::group(['middleware' => 'auth'],
    function () {
        Route::get('letters/getRows', 'LetterController@getRows')->name('letters.getRows');
        Route::get('letters/{letter}/A4', 'LetterController@A4')->name('letters.A4');
        Route::get('letters/{letter}/A5', 'LetterController@A5')->name('letters.A5');
        Route::resource('letters', 'LetterController');
    }
);

I created a link as follow

"<a class='mx-2 h5' href='".route('letters.destroy', $entity->id)."'><i class='icon-remove-circle'></i></a>".

where the $entity->id is the id of the letter. The problem is, it links to show method not the destroy method. What can I do?

Using a form like this


    <button type="submit" >Delete Account</button>


may solve the problem but I want to use a tag not a form.

thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire