Commit f641af0b authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Relaciones de profesion y cargo agregadas a la vista principal

parent 3cd4f08c
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ class ContactoController extends Controller
     */
    public function index()
    {
        $contactos = Contacto::get();
        $contactos = Contacto::with('profesion', 'cargo')->get();
        //dd($contactos);
        return view('adminGen.contactos.index', compact('contactos'));
    }

@@ -164,9 +165,15 @@ public function update(Request $request, Contacto $contacto)
    /**
     * Remove the specified resource from storage.
     */
    public function destroy(Contacto $contacto)
    public function destroy(string $id)
    {
        //
        try{
            $contacto = Contacto::findOrFail($id);
            $contacto->delete();
            return redirect()->route('contacto.get')->with('success', 'Contacto eliminado correctamente.');
        }catch(\Exception $e){
            return redirect()->route('contacto.get')->withErrors('Error al eliminar el contacto.');
        }
    }

    /**