/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(CreateMakerRequest $request, $id) { $maker = Maker::find($id); if (!$maker) { return response()->json(['message' => 'This maker does not exist', 'code' => 404], 404); } $maker->name = $request->get('name'); $maker->phone = $request->get('phone'); $maker->save(); return response()->json(['message' => 'The maker has been updated'], 200); }
public function update(CreateMakerRequest $request, $id) { $maker = Maker::find($id); if (!$maker) { return $this->responseNotFound('Maker does not exist.'); } $maker->name = $request->get('name'); $maker->phone = $request->get('phone'); $maker->save(); return $this->setStatusCode(\Illuminate\Http\Response::HTTP_OK)->respond(['data' => $this->makerTransformer->transform($maker)]); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(CreateMakerRequest $request, $id) { $maker = Maker::find($id); if (!$maker) { return response()->json(['message' => 'No such Maker', 'code' => 404], 404); } $maker->name = $request->get('name'); $maker->phone = $request->get('phone'); $maker->save(); return response()->json(['message' => 'The update of maker was correctly dooded'], 201); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(CreateMakerRequest $request, $id) { $maker = Maker::find($id); if (!$maker) { return response()->json(['message' => 'Maker not found!', 'code' => 404], 404); } $name = $request->get('name'); $phone = $request->get('phone'); $maker->name = $name; $maker->phone = $phone; $maker->save(); return response()->json(['message' => 'Maker updated successfully'], 200); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(CreateMakerRequest $request, $id) { //Verifying maker exist : $maker = Maker::find($id); if (!$maker) { return response()->json(['message' => 'This maker does not exist', 'code' => 404], 404); } //Recuperamos el nombre $name = $request->get('name'); //Recuperamos el telefono $phone = $request->get('phone'); $maker->name = $name; $maker->phone = $phone; $maker->save(); return response()->json(['message' => 'The maker has been updated'], 200); }