mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
added suspend & unsuspend api
This commit is contained in:
parent
d45a7829e6
commit
1f0ecd1011
2 changed files with 44 additions and 0 deletions
|
@ -110,4 +110,46 @@ class HostingSubscriptionsController extends ApiController
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public function suspend($id)
|
||||
{
|
||||
$findHostingSubscription = HostingSubscription::where('id', $id)->first();
|
||||
if ($findHostingSubscription) {
|
||||
|
||||
$findDomains = Domain::where('hosting_subscription_id', $findHostingSubscription->id)->get();
|
||||
if ($findDomains->count() > 0) {
|
||||
foreach ($findDomains as $domain) {
|
||||
$domain->status = Domain::STATUS_SUSPENDED;
|
||||
$domain->save();
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'ok',
|
||||
'message' => 'Hosting subscription suspended',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function unsuspend($id)
|
||||
{
|
||||
$findHostingSubscription = HostingSubscription::where('id', $id)->first();
|
||||
if ($findHostingSubscription) {
|
||||
|
||||
$findDomains = Domain::where('hosting_subscription_id', $findHostingSubscription->id)->get();
|
||||
if ($findDomains->count() > 0) {
|
||||
foreach ($findDomains as $domain) {
|
||||
$domain->status = Domain::STATUS_ACTIVE;
|
||||
$domain->save();
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'ok',
|
||||
'message' => 'Hosting subscription unsuspended',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ Route::middleware(\App\Http\Middleware\ApiKeyMiddleware::class)->group(function(
|
|||
Route::post('hosting-subscriptions', [\App\Http\Controllers\Api\HostingSubscriptionsController::class, 'store'])->name('api.hosting-subscriptions.store');
|
||||
Route::put('hosting-subscriptions/{id}', [\App\Http\Controllers\Api\HostingSubscriptionsController::class, 'update'])->name('api.hosting-subscriptions.update');
|
||||
Route::delete('hosting-subscriptions/{id}', [\App\Http\Controllers\Api\HostingSubscriptionsController::class, 'destroy'])->name('api.hosting-subscriptions.destroy');
|
||||
Route::post('hosting-subscriptions/{id}/suspend', [\App\Http\Controllers\Api\HostingSubscriptionsController::class, 'suspend'])->name('api.hosting-subscriptions.suspend');
|
||||
Route::post('hosting-subscriptions/{id}/unsuspend', [\App\Http\Controllers\Api\HostingSubscriptionsController::class, 'unsuspend'])->name('api.hosting-subscriptions.unsuspend');
|
||||
|
||||
// Domains
|
||||
Route::get('domains', [\App\Http\Controllers\Api\DomainsController::class, 'index'])->name('api.domains.index');
|
||||
|
|
Loading…
Reference in a new issue