public function deleteSubuser(Request $request, $uuid, $id) { $server = Models\Server::getByUUID($uuid); $this->authorize('delete-subuser', $server); try { $subuser = Models\Subuser::select('id')->where(DB::raw('md5(id)'), $id)->where('server_id', $server->id)->first(); if (!$subuser) { throw new DisplayException('No subuser by that ID was found on the system.'); } $repo = new SubuserRepository(); $repo->delete($subuser->id); return response('', 204); } catch (DisplayException $ex) { response()->json(['error' => $ex->getMessage()], 422); } catch (\Exception $ex) { Log::error($ex); response()->json(['error' => 'An unknown error occured while attempting to delete this subuser.'], 503); } }