replace id_operator by id_operator_country
This commit is contained in:
parent
9ebc87f170
commit
575d74bc02
|
|
@ -646,7 +646,7 @@ INNER JOIN countries c ON oc.id_country = c.id INNER JOIN type_operators top ON
|
|||
{
|
||||
$this->validate($request, [
|
||||
'id_user' => 'required|integer|exists:users,id',
|
||||
'id_operator' => 'required|integer|exists:operators,id',
|
||||
'id_operator' => 'required|integer|exists:operators_countries,id',
|
||||
'id_wallet_network' => 'required|integer|exists:networks,id',
|
||||
'lastname' => 'required|string',
|
||||
'firstname' => 'required|string',
|
||||
|
|
@ -674,7 +674,7 @@ INNER JOIN countries c ON oc.id_country = c.id INNER JOIN type_operators top ON
|
|||
$user = User::findOrFail($request->id_user);
|
||||
$identification = $this->checkUserIdentification($user->id);
|
||||
|
||||
$operateur_country = OperatorsCountry::where('id_operator', $request->id_operator)->first();
|
||||
$operateur_country = OperatorsCountry::where('id', $request->id_operator)->first();
|
||||
|
||||
if (!$operateur_country) {
|
||||
return $this->errorResponse(trans('errors.bank_not_associated_with_network'));
|
||||
|
|
@ -694,7 +694,7 @@ INNER JOIN countries c ON oc.id_country = c.id INNER JOIN type_operators top ON
|
|||
}
|
||||
|
||||
$exist_user_request_create_account = UserBankAccount::where('id_user', $request->id_user)
|
||||
->where('id_operator', $request->id_operator)
|
||||
->where('id_operator_country', $request->id_operator)
|
||||
->first();
|
||||
|
||||
if (isset($exist_user_request_create_account)){
|
||||
|
|
@ -708,10 +708,11 @@ INNER JOIN countries c ON oc.id_country = c.id INNER JOIN type_operators top ON
|
|||
return $this->errorResponse(trans('messages.user_already_has_bank_account_with_this_operator', ['user_lastname' => $user->lastname]));
|
||||
}
|
||||
}
|
||||
|
||||
$bank_name = $network_bank->operators_country->operator->nom;
|
||||
|
||||
$bankAccount = new UserBankAccount();
|
||||
$bankAccount->id_user = $user->id;
|
||||
$bankAccount->id_operator = $request->id_operator;
|
||||
$bankAccount->id_operator_country = $request->id_operator;
|
||||
$bankAccount->lastname = $request->lastname;
|
||||
$bankAccount->firstname = $request->firstname;
|
||||
$bankAccount->marital_name = $request->marital_name ?? 'null';
|
||||
|
|
@ -737,7 +738,6 @@ INNER JOIN countries c ON oc.id_country = c.id INNER JOIN type_operators top ON
|
|||
$bankAccount->created_at = date('Y-m-d H:i:s');
|
||||
$bankAccount->updated_at = date('Y-m-d H:i:s');
|
||||
$bankAccount->save();
|
||||
$bank_name = $network_bank->operators_country->operator->nom;
|
||||
|
||||
// Envoi des informations à la banque partenaire (via API)
|
||||
// $payload = [
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ class CreateUserBankAccountsTable extends Migration
|
|||
|
||||
// Référence utilisateur
|
||||
$table->unsignedInteger('id_user');
|
||||
$table->unsignedInteger('id_operator')
|
||||
->comment('Identifiant de l’opérateur (banque partenaire)');
|
||||
$table->unsignedInteger('id_operator_country');
|
||||
|
||||
// Informations bancaires principales
|
||||
$table->string('account_number')->unique()
|
||||
|
|
@ -65,7 +64,7 @@ class CreateUserBankAccountsTable extends Migration
|
|||
|
||||
Schema::table('user_bank_accounts', function (Blueprint $table) {
|
||||
$table->foreign('id_user')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('id_operator')->references('id')->on('operators')->onDelete('cascade');
|
||||
$table->foreign('id_operator_country')->references('id')->on('operators_countries')->onDelete('cascade');
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue