server create account recheak
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\DB\Te\TableEngine;
|
||||
use App\Models\Cnt;
|
||||
use App\Models\Customer;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
|
||||
@@ -45,6 +46,10 @@ class SuperController extends Controller
|
||||
if ($this->name_model == 'customer'){
|
||||
$data['active'] = true;
|
||||
|
||||
if (!empty($data['mobile'])) {
|
||||
Customer::assertMobileUnique($data['mobile']);
|
||||
}
|
||||
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||||
$charactersLength = strlen($characters);
|
||||
do {
|
||||
@@ -97,12 +102,7 @@ class SuperController extends Controller
|
||||
{
|
||||
$data= $request->all();
|
||||
if (isset($data['mobile']) && !is_null($data['mobile'])){
|
||||
$check_mobile = $this->model::where('mobile',$data['mobile'])
|
||||
->where('id','<>',$id)
|
||||
->first();
|
||||
if (!is_null($check_mobile)){
|
||||
throw new UnprocessableEntityHttpException('این شماره همراه توسط شخص دیگری در حال استفاده است');
|
||||
}
|
||||
Customer::assertMobileUnique($data['mobile'], (int) $id);
|
||||
}
|
||||
if (isset($data['fname']) && isset($data['lname'])){
|
||||
$data['name'] = $data['fname'] . ' ' . $data['lname'];
|
||||
|
||||
Reference in New Issue
Block a user