Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/DomainsController.php
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | class DomainsController extends Controller | ||||
{ | { | ||||
$domain = Domain::find($id); | $domain = Domain::find($id); | ||||
if (empty($domain)) { | if (empty($domain)) { | ||||
return $this->errorResponse(404); | return $this->errorResponse(404); | ||||
} | } | ||||
// Only owner (or admin) has access to the domain | // Only owner (or admin) has access to the domain | ||||
if (!$this->guard()->user()->canRead($domain)) { | if (!$this->guard()->user()->canUpdate($domain)) { | ||||
return $this->errorResponse(403); | return $this->errorResponse(403); | ||||
} | } | ||||
$errors = $domain->setConfig(request()->input()); | $errors = $domain->setConfig(request()->input()); | ||||
if (!empty($errors)) { | if (!empty($errors)) { | ||||
return response()->json(['status' => 'error', 'errors' => $errors], 422); | return response()->json(['status' => 'error', 'errors' => $errors], 422); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |