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

148
Vistas
Laravel delete user returns link with ID

I am making a 1 page CRUD application in laravel, Whenever i delete a user i just edited, I get a blank page or a 404. I suppose this happens because the link it returns is: admin/user/{id}. I want to return the base url: admin/user Without the {id} at the end. Is there any way i can do this?

controller destroy code:

public function destroy($id)
    {
       $user = User::find($id);
       $user->delete();
       return back();
    }
almost 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Once the record is deleted, then you can't get that record.

If you want to return back then redirect on specific route.

public function destroy($id)
{
    $user = User::find($id);
    $user->delete();
    return redirect()->route('admin.user')->with('success', 'Your success message');
}

also, you can display the flash message when your URL redirect on page.

Happy Coding!!! 🚀

almost 4 years ago · Santiago Trujillo 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