From 92d9d61d27cbde72ec83d7a5f1b83d60e0542d8b Mon Sep 17 00:00:00 2001 From: Christian Dacid Sullca Puma Date: Fri, 18 Nov 2022 00:14:35 -0500 Subject: [PATCH] agregar detalles del encargado en listar estandares --- app/Http/Controllers/Api/EstandarController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/EstandarController.php b/app/Http/Controllers/Api/EstandarController.php index ad81dc8..8eea3a3 100644 --- a/app/Http/Controllers/Api/EstandarController.php +++ b/app/Http/Controllers/Api/EstandarController.php @@ -41,7 +41,9 @@ public function listEstandar() public function listEstandarValores() { - $estandaresNombreslist = Estandar::select('estandars.name', 'estandars.id') + $estandaresNombreslist = Estandar::select('estandars.name', 'estandars.id', "estandars.id_user", "users.name as user_name", "users.lastname as user_lastname", "users.email as user_email") + ->orderBy('estandars.id', 'asc') + ->join('users', 'estandars.id_user', '=', 'users.id') ->orderBy('estandars.id', 'asc') ->get(); return response([ @@ -51,7 +53,6 @@ public function listEstandarValores() ]); } - public function showEstandar($id) { if (Estandar::where("id", $id)->exists()) { @@ -74,7 +75,7 @@ public function showEstandar($id) public function updateEstandar(Request $request, $id) { - $request->validate([ + $request->validate([ "id_user" => 'exists:App\Models\User,id', ]); @@ -83,7 +84,7 @@ public function updateEstandar(Request $request, $id) $estandar = Estandar::find($id); $estandar->name = isset($request->name) ? $request->name : $estandar->name; $estandar->cabecera = isset($request->cabecera) ? $request->cabecera : $estandar->cabecera; - $estandar->id_user = isset($request->id_user) ? $request->id_user : $estandar->id_user; + $estandar->id_user = isset($request->id_user) ? $request->id_user : $estandar->id_user; $estandar->save(); return response([ "status" => 1,