Validacion de update plan
This commit is contained in:
parent
6a2285690c
commit
c3026c4fdd
@ -161,7 +161,18 @@ public function listPlan(){
|
||||
]);
|
||||
}
|
||||
|
||||
public function updatePlan(Request $request, $id){
|
||||
public function updatePlan(Request $request){
|
||||
$request->validate([
|
||||
"id"=> "required|integer",
|
||||
"nombre"=> "required|max:255",
|
||||
"oportunidad_plan"=> "required|max:255",
|
||||
"semestre_ejecucion"=> "required|max:8",
|
||||
"duracion"=> "required|integer",
|
||||
"estado"=> "required|max:30",
|
||||
"evaluacion_eficacia"=> "required|boolean",
|
||||
"avance"=> "required|integer",
|
||||
]);
|
||||
$id = $request->id;
|
||||
$id_user = auth()->user()->id;
|
||||
if(plan::where(["id_user"=>$id_user,"id"=>$id])->exists()){
|
||||
$plan = plan::find($id);
|
||||
@ -185,7 +196,6 @@ public function updatePlan(Request $request, $id){
|
||||
"message" => "!No se encontro el plan o no esta autorizado",
|
||||
],404);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
Route::get('plan',[PlanController::class,'listPlan']);
|
||||
Route::get('plan/{id}',[PlanController::class,'showPlan']);
|
||||
Route::delete('plan/{id}',[PlanController::class,'deletePlan']);
|
||||
Route::put('plan/{id}',[PlanController::class,'updatePlan']);
|
||||
Route::put('plan',[PlanController::class,'updatePlan']);
|
||||
|
||||
//rutas metas
|
||||
Route::post('meta',[MetasController::class,'create']);
|
||||
|
Loading…
Reference in New Issue
Block a user