work on moving customers from tahesab

This commit is contained in:
2026-06-28 23:41:01 +03:30
parent 7b2d052be1
commit 73ccd4060c
@@ -208,9 +208,13 @@ class TahesabController extends Controller
'type' => 2,
]);
$success++;
} catch (\Exception $e) {
} catch (\Throwable $e) {
$failed++;
$errors[] = ['name' => $item['name'], 'code' => $item['code'], 'error' => $e->getMessage()];
$msg = $e->getMessage();
if ($e instanceof \Illuminate\Database\QueryException && (int) ($e->errorInfo[1] ?? 0) === 1062) {
$msg = 'این مشتری از قبل در پنل ثبت شده است';
}
$errors[] = ['name' => $item['name'], 'code' => $item['code'], 'error' => $msg];
}
}