NASER fix return issues as message

This commit is contained in:
gholak tala
2026-05-04 14:52:50 +00:00
parent f602b519a1
commit 4d85237284
@@ -26,7 +26,7 @@ class GiftCardController extends Controller
}
$codes = [];
if((!is_numeric($count) || $count < 0) || (!is_numeric($amount) || $amount <= 0)){
return response()->json(['error' => 'تعداد کد را چک کنید!'], 400);
return response()->json(['message' => 'تعداد کد را چک کنید!'], 400);
}
$customer = Customer::select('id', 'name', 'mobile')->where('mobile', $request->mobile)->first();
@@ -82,7 +82,7 @@ class GiftCardController extends Controller
$gift = GiftCard::find($giftcode->giftcard_id);
if(!$giftcode){
return response()->json(['error' => 'کد هدیه یافت نشد!'], 404);
return response()->json(['message' => 'کد هدیه یافت نشد!'], 404);
}
//gift order update
@@ -97,14 +97,14 @@ class GiftCardController extends Controller
$giftcode->save();
$gift->save();
return response()->json(['error' => 'کد هدیه منقضی شده است!'], 400);
return response()->json(['message' => 'کد هدیه منقضی شده است!'], 400);
}
$gift->used_count += 1;
$gift->save();
if($giftcode->sts != 1){
return response()->json(['error' => 'کد هدیه قبلا استفاده شده است!'], 400);
return response()->json(['message' => 'کد هدیه قبلا استفاده شده است!'], 400);
}