From c8f7617576e7b09298fe124d3c8accc64074289c Mon Sep 17 00:00:00 2001 From: cgonzalesmo Date: Wed, 2 Nov 2022 22:01:58 -0500 Subject: [PATCH] Commit list User --- app/Http/Controllers/Api/UserController.php | 12 ++++++++++++ routes/api.php | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index a070daf..74be162 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -92,6 +92,18 @@ public function listUser(){ ]); } + public function listUserHabilitados(){ + $users = User::whereNotNull("name")->where("estado",true)->get(); + foreach ($users as $user) { + $user->rol=User::find($user->id)->roles[0]->name; + } + return response([ + "status" => 1, + "msg" => "!Lista de usuarios no nulos y habilitados", + "data" => $users, + ]); + } + public function logout() { auth()->user()->tokens()->delete(); diff --git a/routes/api.php b/routes/api.php index 93f5259..59055e9 100644 --- a/routes/api.php +++ b/routes/api.php @@ -38,7 +38,8 @@ //CAMBIAR ESTO -Route::get('user', [UserController::class, 'listUser']); +//Route::get('user', [UserController::class, 'listUser']); +Route::get('user', [UserController::class, 'listUserHabilitados']); /* Route::get('plan/pdf/{id}', [PlanController::class, 'pdfPlan'])->where('id', '[0-9]+'); */