Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/Admin/DomainsController.php
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | public function index() | ||||
return response()->json($result); | return response()->json($result); | ||||
} | } | ||||
/** | /** | ||||
* Suspend the domain | * Suspend the domain | ||||
* | * | ||||
* @param \Illuminate\Http\Request $request The API request. | * @param \Illuminate\Http\Request $request The API request. | ||||
* @params string $id Domain identifier | * @param string $id Domain identifier | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse The response | * @return \Illuminate\Http\JsonResponse The response | ||||
*/ | */ | ||||
public function suspend(Request $request, $id) | public function suspend(Request $request, $id) | ||||
{ | { | ||||
$domain = Domain::find($id); | $domain = Domain::find($id); | ||||
if (empty($domain) || $domain->isPublic()) { | if (empty($domain) || $domain->isPublic()) { | ||||
return $this->errorResponse(404); | return $this->errorResponse(404); | ||||
} | } | ||||
$domain->suspend(); | $domain->suspend(); | ||||
return response()->json([ | return response()->json([ | ||||
'status' => 'success', | 'status' => 'success', | ||||
'message' => __('app.domain-suspend-success'), | 'message' => __('app.domain-suspend-success'), | ||||
]); | ]); | ||||
} | } | ||||
/** | /** | ||||
* Un-Suspend the domain | * Un-Suspend the domain | ||||
* | * | ||||
* @param \Illuminate\Http\Request $request The API request. | * @param \Illuminate\Http\Request $request The API request. | ||||
* @params string $id Domain identifier | * @param string $id Domain identifier | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse The response | * @return \Illuminate\Http\JsonResponse The response | ||||
*/ | */ | ||||
public function unsuspend(Request $request, $id) | public function unsuspend(Request $request, $id) | ||||
{ | { | ||||
$domain = Domain::find($id); | $domain = Domain::find($id); | ||||
if (empty($domain) || $domain->isPublic()) { | if (empty($domain) || $domain->isPublic()) { | ||||
Show All 11 Lines |