Added new api

This commit is contained in:
m.razaghi
2026-07-04 17:05:50 +03:30
parent f242b8936a
commit ce5ccc00a1
11 changed files with 1006 additions and 17 deletions

View File

@@ -62,7 +62,7 @@ class SubscribePlanController extends Controller
->first();
if ($activeSubscription && ! $activeSubscription?->subscribe?->is_free && ! $subscribePlan->is_free) {
return $this->failed(null, ['title' => 'Subscribe Plan', 'message' => 'You already have an active subscription. Please wait until it expires.']);
return $this->failed(null, ['title' => 'اشتراک', 'message' => 'شما درحال حاظر اشتراک فعال دارید']);
}
if ($subscribePlan->is_free) {
@@ -72,7 +72,7 @@ class SubscribePlanController extends Controller
})->exists();
if ($hasUsedFreePlan) {
return $this->failed(null, ['title' => 'Subscribe Plan', 'message' => 'You have already used the free plan.']);
return $this->failed(null, ['title' => 'اشتراک', 'message' => 'شما قبلا اشتراک رایگان فعال کردید']);
}
$expiredAt = now()->addDays($subscribePlan->expired_day + 1);
@@ -82,7 +82,7 @@ class SubscribePlanController extends Controller
'expired_at' => $expiredAt,
]);
return $this->success(null, 'Subscribe Plan', 'Free Subscribe Plan Successfully Activated');
return $this->success(null, 'اشتراک', 'اشتراک رایگان شما فعال شد');
}
try {
@@ -133,7 +133,7 @@ class SubscribePlanController extends Controller
->exists();
if ($hasUsedFreePlan) {
return $this->failed(null, ['title' => 'Subscribe Plan', 'message' => 'You have already used the free plan.']);
return $this->failed(null, ['title' => 'اشتراک', 'message' => 'شما قبلا اشتراک رایگان فعال کردید']);
}
$expiredAt = $activeSubscription ? $activeSubscription->expired_at->addDays($subscribePlan->expired_day) : now()->addDays($subscribePlan->expired_day);
@@ -144,7 +144,7 @@ class SubscribePlanController extends Controller
'is_free' => true,
]);
return $this->success(null, 'Subscribe Plan', 'Free Subscribe Plan Successfully Activated');
return $this->success(null, 'اشتراک', 'اشتراک رایگان فعال شد');
}
$subscription_id = $request->input('subscription_id');
@@ -177,7 +177,7 @@ class SubscribePlanController extends Controller
'is_free' => false,
]);
return $this->success(null, 'Subscribe Plan', 'Subscription successfully activated.');
return $this->success(null, 'اشتراک', 'اشتراک شما فعال شد');
} catch (\Exception $e) {
Log::error('Error in subscription', ['Error' => $e->getMessage()]);