Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

402
Vistas
laravel - Delete method not working in laravel 8

Hello I'm still a beginner at laravel, I got a problem on the delete method.

this my controller

public function destroy($id)
    {
        $home = Home::find($id);
        $home -> delete();
        return back();
    }

this my balde

<div class="col-6 sampah">
 <form action="{{ route('home.destroy', $home->id) }}" method="POST">
  @csrf
  @method('DELETE')
    <a href="">
    <i class="bi bi-trash3-fill" style="width: 10px; height:10px;"></i>
    </a>
 </form>
</div>

this my route

Route::resource('home', 'App\Http\Controllers\TodosController')->middleware('auth');

When I press the delete button, why doesn't it work? Where is the problem? pls, help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

At the first you need to get what you want to delete this is an example for you it would be your controller:

///REPLACE Crud with your MODEL////

   public function destroy(Request $request,$id){
        $data = Crud::findOrFail($id);
        $data->delete();
        return redirect('YOUR_HOME_PAGE')->with('success', 'User is successfully deleted');
}

this is your blade:

<td>
                
                    <form action="{{ route('home.destroy', $row->id) }}" method="post">
                                                
                    @csrf
                    @method('DELETE')
                    <button type="submit"  class="btn btn-xs btn-danger btn-flat show_confirm" data-toggle="tooltip" title='Delete'>Delete</button>
                </form>
            </td>
        </tr>


 
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda