+ Fix bug on create groupe

This commit is contained in:
Djery-Tom 2020-08-19 19:46:52 +01:00
parent 89ffc033f5
commit 5a953b33b6
5 changed files with 83 additions and 3 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Models\AgentPlus; use App\Models\AgentPlus;
use App\Models\CodeGenerer; use App\Models\CodeGenerer;
use App\Models\ConfigWallet; use App\Models\ConfigWallet;
use App\Models\Identification;
use App\Models\NetworksAgent; use App\Models\NetworksAgent;
use App\Models\UsersDemandesCredit; use App\Models\UsersDemandesCredit;
use App\Models\UsersGroup; use App\Models\UsersGroup;
@ -48,7 +49,9 @@ class NanoCreditController extends Controller
if (!$this->checkPassword($request->password, $user->encrypted_password, $user->salt)) if (!$this->checkPassword($request->password, $user->encrypted_password, $user->salt))
return $this->errorResponse(trans('messages.incorrect_user_password')); return $this->errorResponse(trans('messages.incorrect_user_password'));
$this->checkMyIdentification($request->id_user); $identfication = $this->checkMyIdentification($request->id_user);
if (!($identfication instanceof Identification))
return $identfication;
$init_country = $user->network->country->id; $init_country = $user->network->country->id;
$result = ConfigWallet::join('networks', 'networks.id', '=', 'configWallet.id_network') $result = ConfigWallet::join('networks', 'networks.id', '=', 'configWallet.id_network')

View File

@ -48,7 +48,9 @@ class UserGroupController extends Controller
if (!$this->checkPassword($request->password, $user->encrypted_password, $user->salt)) if (!$this->checkPassword($request->password, $user->encrypted_password, $user->salt))
return $this->errorResponse(trans('messages.incorrect_user_password')); return $this->errorResponse(trans('messages.incorrect_user_password'));
$this->checkMyIdentification($request->id_user); $identfication = $this->checkMyIdentification($request->id_user);
if (!($identfication instanceof Identification))
return $identfication;
//Verifier s'il appartient a un groupe //Verifier s'il appartient a un groupe
if (isset($user->group_id)) if (isset($user->group_id))
@ -397,7 +399,9 @@ ug.date_creation , ug.createur , ug.sponsor1 , ug.sponsor2 , ug.sponsor3, ug.cou
if ($country_user != $country_sponsor) if ($country_user != $country_sponsor)
return $this->errorResponse(trans('errors.not_registered_in_same_country')); return $this->errorResponse(trans('errors.not_registered_in_same_country'));
$this->checkMyIdentification($request->id_user); $identfication = $this->checkMyIdentification($request->id_user);
if (!($identfication instanceof Identification))
return $identfication;
$user->group_id = $group->id; $user->group_id = $group->id;
$user->date_adhesion = new \DateTime(); $user->date_adhesion = new \DateTime();

View File

@ -212,6 +212,8 @@ trait Helper
if (isset($identification)) { if (isset($identification)) {
if ($identification->status == 0) if ($identification->status == 0)
return $this->errorResponse(trans('errors.validation_identification_required')); return $this->errorResponse(trans('errors.validation_identification_required'));
else
return $identification;
} else { } else {
return $this->errorResponse(trans('errors.identification_required')); return $this->errorResponse(trans('errors.identification_required'));
} }

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}