使用 eloquent return 删除,但没有删除任何内容

Deleting with eloquent return, but nothing is deleted

当我尝试删除某些内容时,没有任何反应,但我得到了 return。 我尝试在 destroy 方法上使用 $id 而不是 Game $game,但它也不起作用。

路线:

Route::group([
'prefix' => '/jogos',
'as' => 'games.'
],function (){
    Route::get('/','App\Http\Controllers\GamesController@index') -> name('index');
    Route::get('/cadastro','App\Http\Controllers\GamesController@create') -> name('create');
    Route::post('/cadastro','App\Http\Controllers\GamesController@store') -> name('store');
    Route::get('/editar/{id}','App\Http\Controllers\GamesController@edit') -> name('edit');
    Route::patch('/editar/{id}','App\Http\Controllers\GamesController@update') -> name('update');
    Route::delete('/','App\Http\Controllers\GamesController@destroy') -> name('destroy');
}); 

控制器:

public function destroy($id){
    Game::destroy($id);
    return redirect() -> route('games.index') -> with('success','Jogo excluído com sucesso');
}

查看:

      <tbody>
        @foreach($games as $game)
            <tr>
                <td class="col-3">{{ $game->name }}</td>
                <td>{{ $game->description }}</td>
                <td class="col-2">
                    <form action="{{ route('games.destroy',$game->id) }}" method="POST">
                        @csrf
                        @method('DELETE')
                        <a href="{{ route('games.edit',$game->id) }}" class="btn btn-sm btn-warning">Editar</a>
                        <button type="submit" class="btn btn-sm btn-danger">Apagar</button>
                    </form>
                </td>
            </tr>
        @endforeach
    </tbody>

控制器中的 destroy 函数需要一个 'id' 作为参数。这意味着您必须在路径中提供一个 id 参数,如下所示:

Route::delete('/{id}', ...);

我更改了函数 destroy,它保持原样:

public function destroy($id){
    Game::where('id',$id)->delete();
    return redirect('/jogos') -> with('success','Jogo excluído com sucesso');
}

但我还不知道为什么另一种方法不起作用。