From 1d614acb12107f8b628f4dc9a291e826f4d1eff6 Mon Sep 17 00:00:00 2001 From: Christian Dacid Sullca Puma Date: Tue, 25 Oct 2022 22:20:29 -0500 Subject: [PATCH] arreglo evidencias 3 --- app/Http/Controllers/Api/EvidenciasController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/EvidenciasController.php b/app/Http/Controllers/Api/EvidenciasController.php index 427c46f..cdb99e5 100644 --- a/app/Http/Controllers/Api/EvidenciasController.php +++ b/app/Http/Controllers/Api/EvidenciasController.php @@ -91,7 +91,7 @@ public function update(Request $request) if (Evidencias::where(["id" => $request->id])->exists()) { $evidencia = Evidencias::find($request->id); $plan = plan::find($evidencia->id_plan); - if ($plan->id_user == $id_user->id or $id_user->isAdmin()) { + if ($id_user->isCreadorPlan($plan->id) or $id_user->isAdmin()) { $evidencia->codigo = $request->codigo; $evidencia->denominacion = $request->denominacion; $path = $request->adjunto->store('evidencias'); @@ -122,7 +122,7 @@ public function delete($id) if (Evidencias::where(["id" => $id])->exists()) { $evidencia = Evidencias::find($id); $plan = plan::find($evidencia->id_plan); - if ($plan->id_user == $id_user->id or $id_user->isAdmin()) { + if ($id_user->isCreadorPlan($plan->id) or $id_user->isAdmin()) { $evidencia->delete(); return response([ "status" => 1,