From 4c2b31dad53a085b0e6aad868cd09bafafa11675 Mon Sep 17 00:00:00 2001 From: rats4final <80012704+rats4final@users.noreply.github.com> Date: Thu, 10 Nov 2022 05:09:18 -0400 Subject: [PATCH] tipo relacion ajustes --- .../Controllers/TipoRelacionController.php | 91 +++++++++++++++++++ app/Models/TipoRelacion.php | 25 +++++ 2 files changed, 116 insertions(+) create mode 100644 app/Http/Controllers/TipoRelacionController.php create mode 100644 app/Models/TipoRelacion.php diff --git a/app/Http/Controllers/TipoRelacionController.php b/app/Http/Controllers/TipoRelacionController.php new file mode 100644 index 0000000..4916bd6 --- /dev/null +++ b/app/Http/Controllers/TipoRelacionController.php @@ -0,0 +1,91 @@ +all(); + TipoRelacion::create($datos); + return to_route('TipoRelacion.index'); + } + + /** + * Display the specified resource. + * + * @param \App\Models\TipoRelacion $TipoRelacion + * @return \Illuminate\Http\Response + */ + public function show(TipoRelacion $TipoRelacion) + { + return view('admin.tipo_relacion.show', compact('TipoRelacion')); + } + + /** + * Show the form for editing the specified resource. + * + * @param \App\Models\TipoRelacion $tipoRelacion + * @return \Illuminate\Http\Response + */ + public function edit(TipoRelacion $tipoRelacion) + { + return view('admin.tipo_relacion.edit', compact('tipoRelacion')); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param \App\Models\TipoRelacion $tipoRelacion + * @return \Illuminate\Http\Response + */ + public function update(Request $request, TipoRelacion $tipoRelacion) + { + $datos = $request->all(); + $tipoRelacion->update($datos); + return to_route('TipoRelacion.index'); + } + + /** + * Remove the specified resource from storage. + * + * @param \App\Models\TipoRelacion $tipoRelacion + * @return \Illuminate\Http\Response + */ + public function destroy(TipoRelacion $tipoRelacion) + { + $tipoRelacion->delete(); + return to_route('TipoRelacion.index'); + } +} diff --git a/app/Models/TipoRelacion.php b/app/Models/TipoRelacion.php new file mode 100644 index 0000000..f2f5816 --- /dev/null +++ b/app/Models/TipoRelacion.php @@ -0,0 +1,25 @@ +hasOne(Persona::class,'id_persona','id_persona'); + } + public function pariente(){ + return $this->hasOne(Persona::class,'id_persona','id_pariente'); + } +}