fix(coupon): correct knows issues
This commit is contained in:
@@ -11,11 +11,11 @@ class CouponController extends Controller
|
||||
{
|
||||
public function check(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'code' => 'required|string',
|
||||
'plan_id' => 'required|integer',
|
||||
'period' => 'nullable|string',
|
||||
]);
|
||||
// $request->validate([
|
||||
// 'code' => 'required|string',
|
||||
// 'plan_id' => 'required|integer',
|
||||
// 'period' => 'nullable|string',
|
||||
// ]);
|
||||
if (empty($request->input('code'))) {
|
||||
return $this->fail([422,__('Coupon cannot be empty')]);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,8 @@ class PlanService
|
||||
*/
|
||||
public static function convertToLegacyPeriod(string $period): string
|
||||
{
|
||||
return Plan::LEGACY_PERIOD_MAPPING[$period] ?? $period;
|
||||
$flippedMapping = array_flip(Plan::LEGACY_PERIOD_MAPPING);
|
||||
return $flippedMapping[$period] ?? $period;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user