How to delete data in DB Laravel 7

Can someone tell me what my mistake is when deleting data from the database Previously, when I used a similar method, everything worked correctly. But now for some reason when I click to delete the last record, the first one is deleted I have used several different methods but the result is the same There is my code in controller

public function destroy(Coin $coin)
{
Coin::where('id', '=', $coin->id)->first()->delete();
Coin::find($coin->id)->delete();
$coin->delete($coin->id);
$coin->delete();
Coin::destroy($coin->id);
return back();
}

There is my route

Route::post('/coins/delete/{coin}', 'CoinController@destroy')->name('coins.delete');


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35dCw25
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time