Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/DomainsController.php
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | class DomainsController extends Controller | ||||
* @return \Illuminate\Http\JsonResponse|void | * @return \Illuminate\Http\JsonResponse|void | ||||
*/ | */ | ||||
public function confirm($id) | public function confirm($id) | ||||
{ | { | ||||
$domain = Domain::findOrFail($id); | $domain = Domain::findOrFail($id); | ||||
// Only owner (or admin) has access to the domain | // Only owner (or admin) has access to the domain | ||||
if (!self::hasAccess($domain)) { | if (!self::hasAccess($domain)) { | ||||
return abort(403); | return $this->errorResponse(403); | ||||
} | } | ||||
if (!$domain->confirm()) { | if (!$domain->confirm()) { | ||||
return response()->json(['status' => 'error']); | return response()->json(['status' => 'error']); | ||||
} | } | ||||
return response()->json([ | return response()->json([ | ||||
'status' => 'success', | 'status' => 'success', | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | class DomainsController extends Controller | ||||
* @return \Illuminate\Http\JsonResponse|void | * @return \Illuminate\Http\JsonResponse|void | ||||
*/ | */ | ||||
public function show($id) | public function show($id) | ||||
{ | { | ||||
$domain = Domain::findOrFail($id); | $domain = Domain::findOrFail($id); | ||||
// Only owner (or admin) has access to the domain | // Only owner (or admin) has access to the domain | ||||
if (!self::hasAccess($domain)) { | if (!self::hasAccess($domain)) { | ||||
return abort(403); | return $this->errorResponse(403); | ||||
} | } | ||||
$response = $domain->toArray(); | $response = $domain->toArray(); | ||||
// Add hash information to the response | // Add hash information to the response | ||||
$response['hash_text'] = $domain->hash(Domain::HASH_TEXT); | $response['hash_text'] = $domain->hash(Domain::HASH_TEXT); | ||||
$response['hash_cname'] = $domain->hash(Domain::HASH_CNAME); | $response['hash_cname'] = $domain->hash(Domain::HASH_CNAME); | ||||
$response['hash_code'] = $domain->hash(Domain::HASH_CODE); | $response['hash_code'] = $domain->hash(Domain::HASH_CODE); | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |