+ Verify users identification
This commit is contained in:
parent
da240a732b
commit
a0e27c10ba
|
@ -42,12 +42,11 @@ class UserController extends Controller
|
|||
|
||||
$identification->fill($request->all());
|
||||
$identification->id_user = $user->id;
|
||||
$identification->user_code = $this->generateRandomString();
|
||||
$identification->status = 0;
|
||||
|
||||
$identification->save();
|
||||
$this->sendMail($user->email,trans('messages.successful_identification'),
|
||||
trans('messages.successful_identification_message',['name'=>$identification->lastname.' '.$identification->firstname,'user_code'=>$identification->user_code]));
|
||||
trans('messages.successful_identification_message',['name'=>$identification->lastname.' '.$identification->firstname]));
|
||||
return $this->successResponse(trans('messages.successful_identification'));
|
||||
}
|
||||
|
||||
|
@ -71,25 +70,28 @@ class UserController extends Controller
|
|||
$identification->document_image_front = $this->uploadImage($request,'document_image_front','D-F',"documents");
|
||||
$identification->document_image_back = $this->uploadImage($request,'document_image_back','D-B',"documents");
|
||||
$identification->user_image = $this->uploadImage($request,'user_image','U',"photos");
|
||||
$identification->user_code = $this->generateRandomString();
|
||||
$identification->status = 1;
|
||||
|
||||
$identification->save();
|
||||
$this->sendMail($identification->user->email,trans('messages.validated_identification'),trans('messages.validated_identification_message'));
|
||||
$this->sendMail($identification->user->email,trans('messages.validated_identification'),trans('messages.validated_identification_message',['user_code'=>$identification->user_code]));
|
||||
return $this->successResponse(trans('messages.validated_identification'));
|
||||
}
|
||||
|
||||
public function fetchIdentification($user_code)
|
||||
public function fetchIdentification($user_phone)
|
||||
{
|
||||
return Identification::where('user_code', $user_code)->firstOrFail();
|
||||
$user = User::where('phone', $user_phone)->firstOrFail();
|
||||
return Identification::where('id_user', $user->id)->firstOrFail();
|
||||
}
|
||||
|
||||
public function verifyIdentification($id_user)
|
||||
public function verifyIdentification($user_phone)
|
||||
{
|
||||
$identification = Identification::where('id_user', $id_user)->firstOrFail();
|
||||
if($identification->status == 1)
|
||||
return $this->successResponse(trans('messages.user_identificated'),Response::HTTP_NO_CONTENT);
|
||||
else
|
||||
return $this->successResponse($identification);
|
||||
$user = User::where('phone', $user_phone)->firstOrFail();
|
||||
$identification = Identification::where('id_user', $user->id)->first();
|
||||
if($identification){
|
||||
return $this->errorResponse(trans('messages.user_identificated'));
|
||||
}else
|
||||
return $this->successResponse($user);
|
||||
}
|
||||
|
||||
private function generateRandomString($length = 10)
|
||||
|
|
|
@ -15,12 +15,12 @@ return [
|
|||
'successful_identification_message' => 'Hi :name,
|
||||
|
||||
Your identification has been taken into account. Contact an iLink World agent with your ID to validate your identity.
|
||||
Your username: :user_code
|
||||
|
||||
Regards,
|
||||
iLinkWorld team.',
|
||||
'validated_identification_message' => 'Your identification is confirmed!
|
||||
|
||||
Your username: :user_code
|
||||
You can now use the services of iLink World.
|
||||
Welcome to the iLink World family !!!
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ return [
|
|||
'successful_identification_message' => 'Salut :name,
|
||||
|
||||
Votre identification a été prise en compte . Rapprochez vous auprès d\'un agent iLink World muni de votre pièce d\'identité pour faire valider de votre identité.
|
||||
Votre identifiant : :user_code
|
||||
|
||||
Cordialement,
|
||||
Equipe iLinkWorld.',
|
||||
'validated_identification_message' => 'Votre identification est confirmée !
|
||||
|
||||
Votre identifiant : :user_code
|
||||
Vous pouvez desormais utiliser les services de iLink World.
|
||||
Bienvenue dans la famille iLink World !!!
|
||||
|
||||
|
|
|
@ -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_code}','UserController@fetchIdentification');
|
||||
$router->get('verify/{id_user}','UserController@verifyIdentification');
|
||||
$router->get('{user_phone}','UserController@fetchIdentification');
|
||||
$router->get('verify/{user_phone}','UserController@verifyIdentification');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue