diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 9700efa..496436c 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -78,10 +78,18 @@ class UserController extends Controller return $this->successResponse(trans('messages.validated_identification')); } - public function fetchIdentification($user_phone) + public function fetchIdentification($id_user) { - $user = User::where('phone', $user_phone)->firstOrFail(); - return Identification::where('id_user', $user->id)->firstOrFail(); +// return Identification::where('id_user', $id_user)->firstOrFail(); + $identification = Identification::where('id_user', $id_user)->first(); + $data['isIdentified'] = false; + $data['isIdentifiedValidated'] = false; + $data['data'] = $identification; + if($identification){ + $data['isIdentified'] = true; + $data['isIdentifiedValidated'] = $identification->status == 1 ; + } + return $this->successResponse($data); } public function verifyIdentification($user_phone) diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 6b3f181..a9dd35b 100755 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -10,6 +10,7 @@ return [ 'canceled_transaction' => 'Canceled transaction', 'successful_identification'=>'User :name has been successfully identified.', 'user_identificated' => 'User already identificated', + 'user_not_identificated' => 'User is not identificated', 'validated_identification'=>'Validated identification', 'identification_already_validated'=>'Identification already validated', 'successful_identification_message' => 'Hi :name, diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index 5fcb27b..c9a3bc1 100755 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -11,6 +11,7 @@ return [ 'successful_identification' => 'L\'utilisateur :name a été identifié avec succes', 'validated_identification' => 'Identification validée', 'user_identificated' => 'Utilisateur déjà identifié', + 'user_not_identificated' => 'Utilisateur non identifié', 'identification_already_validated' => 'Identification deja validée', 'successful_identification_message' => 'Salut :name, diff --git a/routes/web.php b/routes/web.php index e10870a..01d90d4 100755 --- a/routes/web.php +++ b/routes/web.php @@ -47,7 +47,7 @@ $router->group(['prefix' => '/wallets'] , function () use ($router){ $router->group(['prefix' => '/identifications'] , function () use ($router){ $router->post('','UserController@identification'); $router->post('{id_identification}','UserController@validateIdentification'); - $router->get('{user_phone}','UserController@fetchIdentification'); + $router->get('{id_user}','UserController@fetchIdentification'); $router->get('verify/{user_phone}','UserController@verifyIdentification'); });