/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { try { $this->statementService->validateInput($request->all(), true, $id); } catch (\Exception $e) { abort(422); } $response = $this->statementService->update($request, $id); return response()->json($response); }
/** * Updates a statement * * @param $input * @param $id * * @return array */ public function update($input, $id) { $statement = $this->statement->findOrFail($id); $statement->update(["period" => $input->period, "due_date" => $input->due_date, "deadline" => $input->deadline, "has_real_dates" => $input->has_real_dates, "credit_card_id" => $input->credit_card_id]); return ["id" => $statement->id]; }