/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $user = JWTAuth::parseToken()->authenticate(); if (!Controller::supreme($user->role)) { return Controller::response(Controller::error(13), 401); } if (!is_numeric($id)) { return Controller::response(Controller::error(38), 400); } if (empty($request->all())) { return Controller::response($request, 304); } $response = $this->newsletter->updateNewsletter($request, $id); if (isset($response['error'])) { return Controller::response(Controller::error($response['error']), 400); } return Controller::response($response, 200); }