+ Update fetch identification

This commit is contained in:
Djery-Tom 2020-06-16 12:23:09 +01:00
parent d6ac8c0e5e
commit 9fe2fcdcf0
4 changed files with 14 additions and 4 deletions

View File

@ -78,10 +78,18 @@ class UserController extends Controller
return $this->successResponse(trans('messages.validated_identification')); 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', $id_user)->firstOrFail();
return Identification::where('id_user', $user->id)->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) public function verifyIdentification($user_phone)

View File

@ -10,6 +10,7 @@ return [
'canceled_transaction' => 'Canceled transaction', 'canceled_transaction' => 'Canceled transaction',
'successful_identification'=>'User :name has been successfully identified.', 'successful_identification'=>'User :name has been successfully identified.',
'user_identificated' => 'User already identificated', 'user_identificated' => 'User already identificated',
'user_not_identificated' => 'User is not identificated',
'validated_identification'=>'Validated identification', 'validated_identification'=>'Validated identification',
'identification_already_validated'=>'Identification already validated', 'identification_already_validated'=>'Identification already validated',
'successful_identification_message' => 'Hi :name, 'successful_identification_message' => 'Hi :name,

View File

@ -11,6 +11,7 @@ return [
'successful_identification' => 'L\'utilisateur :name a été identifié avec succes', 'successful_identification' => 'L\'utilisateur :name a été identifié avec succes',
'validated_identification' => 'Identification validée', 'validated_identification' => 'Identification validée',
'user_identificated' => 'Utilisateur déjà identifié', 'user_identificated' => 'Utilisateur déjà identifié',
'user_not_identificated' => 'Utilisateur non identifié',
'identification_already_validated' => 'Identification deja validée', 'identification_already_validated' => 'Identification deja validée',
'successful_identification_message' => 'Salut :name, 'successful_identification_message' => 'Salut :name,

View File

@ -47,7 +47,7 @@ $router->group(['prefix' => '/wallets'] , function () use ($router){
$router->group(['prefix' => '/identifications'] , function () use ($router){ $router->group(['prefix' => '/identifications'] , function () use ($router){
$router->post('','UserController@identification'); $router->post('','UserController@identification');
$router->post('{id_identification}','UserController@validateIdentification'); $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'); $router->get('verify/{user_phone}','UserController@verifyIdentification');
}); });