Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/UsersController.php
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | class UsersController extends Controller | ||||
public function setConfig($id) | public function setConfig($id) | ||||
{ | { | ||||
$user = User::find($id); | $user = User::find($id); | ||||
if (empty($user)) { | if (empty($user)) { | ||||
return $this->errorResponse(404); | return $this->errorResponse(404); | ||||
} | } | ||||
if (!$this->guard()->user()->canRead($user)) { | if (!$this->guard()->user()->canUpdate($user)) { | ||||
return $this->errorResponse(403); | return $this->errorResponse(403); | ||||
} | } | ||||
$errors = $user->setConfig(request()->input()); | $errors = $user->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 723 Lines • Show Last 20 Lines |