+ Update simple users identification
This commit is contained in:
parent
e114ce4fe5
commit
e5d1b7edf5
|
@ -55,12 +55,16 @@ class UserController extends Controller
|
||||||
// dd($request->allFiles());
|
// dd($request->allFiles());
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'id_network' => 'required|integer|min:0|not_in:0',
|
'id_network' => 'required|integer|min:0|not_in:0',
|
||||||
'document_image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:6048',
|
'id_country' => 'required|integer|min:0|not_in:0',
|
||||||
|
'document_image_front' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:6048',
|
||||||
|
'document_image_back' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:6048',
|
||||||
'user_image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:6048',
|
'user_image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:6048',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$identification->idNetwork = $request->id_network;
|
$identification->idNetwork = $request->id_network;
|
||||||
$identification->document_image = $this->uploadImage($request,'document_image','D',"documents");
|
$identification->id_country = $request->id_country;
|
||||||
|
$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_image = $this->uploadImage($request,'user_image','U',"photos");
|
||||||
$identification->status = 1;
|
$identification->status = 1;
|
||||||
|
|
||||||
|
@ -69,6 +73,20 @@ class UserController extends Controller
|
||||||
return $this->successResponse(trans('messages.validated_identification'));
|
return $this->successResponse(trans('messages.validated_identification'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function fetchIdentification($user_code)
|
||||||
|
{
|
||||||
|
return Identification::where('user_code', $user_code)->firstOrFail();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifyIdentification($id_user)
|
||||||
|
{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
private function generateRandomString($length = 10)
|
private function generateRandomString($length = 10)
|
||||||
{
|
{
|
||||||
$characters = '23456789abcdefghjkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ';
|
$characters = '23456789abcdefghjkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ';
|
||||||
|
|
|
@ -25,9 +25,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
* @property int $status
|
* @property int $status
|
||||||
* @property Carbon $createdAt
|
* @property Carbon $createdAt
|
||||||
* @property string $user_image
|
* @property string $user_image
|
||||||
* @property string $document_image
|
* @property string $document_image_front
|
||||||
|
* @property string $document_image_back
|
||||||
* @property string $user_code
|
* @property string $user_code
|
||||||
* @property int $idNetwork
|
* @property int $idNetwork
|
||||||
|
* @property int $country_id
|
||||||
*
|
*
|
||||||
* @property User $user
|
* @property User $user
|
||||||
* @property Network $network
|
* @property Network $network
|
||||||
|
@ -42,7 +44,8 @@ class Identification extends Model
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'id_user' => 'int',
|
'id_user' => 'int',
|
||||||
'status' => 'int',
|
'status' => 'int',
|
||||||
'idNetwork' => 'int'
|
'idNetwork' => 'int',
|
||||||
|
'country_id' => 'int'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
|
@ -56,7 +59,7 @@ class Identification extends Model
|
||||||
'lastname',
|
'lastname',
|
||||||
'birth_date',
|
'birth_date',
|
||||||
'town',
|
'town',
|
||||||
'country',
|
'country',
|
||||||
'identity_document',
|
'identity_document',
|
||||||
'id_identity_document',
|
'id_identity_document',
|
||||||
'expiry_date_document',
|
'expiry_date_document',
|
||||||
|
@ -64,15 +67,21 @@ class Identification extends Model
|
||||||
'status',
|
'status',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'user_image',
|
'user_image',
|
||||||
'document_image',
|
'document_image_front',
|
||||||
|
'document_image_back',
|
||||||
'user_code',
|
'user_code',
|
||||||
'idNetwork'
|
'idNetwork',
|
||||||
|
'country_id'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function country()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Country::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'idUser');
|
return $this->belongsTo(User::class, 'id_user');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function network()
|
public function network()
|
||||||
|
|
|
@ -9,6 +9,7 @@ return [
|
||||||
'canceled_credit_request' => 'Canceled credit request',
|
'canceled_credit_request' => 'Canceled credit request',
|
||||||
'canceled_transaction' => 'Canceled transaction',
|
'canceled_transaction' => 'Canceled transaction',
|
||||||
'successful_identification'=>'Successful identification',
|
'successful_identification'=>'Successful identification',
|
||||||
|
'user_identificated' => 'User already 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,
|
||||||
|
|
|
@ -10,6 +10,7 @@ return [
|
||||||
'canceled_transaction' => 'Transaction annulée',
|
'canceled_transaction' => 'Transaction annulée',
|
||||||
'successful_identification' => 'Identification réussie',
|
'successful_identification' => 'Identification réussie',
|
||||||
'validated_identification' => 'Identification validée',
|
'validated_identification' => 'Identification validée',
|
||||||
|
'user_identificated' => 'Utilisateur déjà 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,
|
||||||
|
|
||||||
|
|
|
@ -47,5 +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_code}','UserController@fetchIdentification');
|
||||||
|
$router->get('verify/{id_user}','UserController@verifyIdentification');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue