NASER fix return issues as message
This commit is contained in:
@@ -26,7 +26,7 @@ class GiftCardController extends Controller
|
|||||||
}
|
}
|
||||||
$codes = [];
|
$codes = [];
|
||||||
if((!is_numeric($count) || $count < 0) || (!is_numeric($amount) || $amount <= 0)){
|
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();
|
$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);
|
$gift = GiftCard::find($giftcode->giftcard_id);
|
||||||
|
|
||||||
if(!$giftcode){
|
if(!$giftcode){
|
||||||
return response()->json(['error' => 'کد هدیه یافت نشد!'], 404);
|
return response()->json(['message' => 'کد هدیه یافت نشد!'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
//gift order update
|
//gift order update
|
||||||
@@ -97,14 +97,14 @@ class GiftCardController extends Controller
|
|||||||
$giftcode->save();
|
$giftcode->save();
|
||||||
$gift->save();
|
$gift->save();
|
||||||
|
|
||||||
return response()->json(['error' => 'کد هدیه منقضی شده است!'], 400);
|
return response()->json(['message' => 'کد هدیه منقضی شده است!'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gift->used_count += 1;
|
$gift->used_count += 1;
|
||||||
$gift->save();
|
$gift->save();
|
||||||
|
|
||||||
if($giftcode->sts != 1){
|
if($giftcode->sts != 1){
|
||||||
return response()->json(['error' => 'کد هدیه قبلا استفاده شده است!'], 400);
|
return response()->json(['message' => 'کد هدیه قبلا استفاده شده است!'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user