server create account recheak

This commit is contained in:
2026-07-02 16:12:39 +03:30
parent 17e50de53e
commit 184977462a
6 changed files with 92 additions and 22 deletions
+6 -6
View File
@@ -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'];