Correcion de EDITAR PM (Auth)

This commit is contained in:
cgonzalesmo 2022-10-03 14:14:36 -05:00
parent 04972b9fb6
commit adae29fd81

View File

@ -20,6 +20,8 @@
class PlanController extends Controller{
public function update(Request $request,$id){
$id_user = auth()->user()->id;
if(plan::where(["id_user"=>$id_user,"id"=>$id])->exists()){
//Actualizamos los atributos propios
$plan = plan::find($id);
$plan -> update([
@ -182,9 +184,16 @@ public function update(Request $request,$id){
]);
}
}
return response()->json($plan, 200);
}
else{
return response([
"status" => 0,
"message" => "!No se encontro el plan o no esta autorizado",
],404);
}
}
// Arreglar el formato de IDs
public function createPlan(Request $request){