mardi 20 octobre 2020

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

Aucun commentaire:

Enregistrer un commentaire