コード例 #1
0
ファイル: TagController.php プロジェクト: aamirr/lazada_test
 /**
  * @SWG\Api(
  *  path="/tag/{id}",
  *      @SWG\Operation(
  *          method="PUT",
  *          summary="Updates a specific tag",
  *          nickname="HTTP PUT tag",
  *      @SWG\Parameter(
  *          name="id",
  *          description="id of tag to update",
  *          paramType="path",
  *              required=true,
  *              allowMultiple=false,
  *              type="string"
  *          ),
  *      @SWG\Parameter(
  *          name="name",
  *          description="Name to update",
  *          paramType="form",
  *              required=true,
  *              allowMultiple=false,
  *              type="string"
  *          ),
  *  )
  * )
  */
 public function update(StoreTagRequest $request, $id)
 {
     $tag = $this->tag->find($id);
     if (!$tag) {
         return $this->error('Tag not found', self::NOT_FOUND);
     }
     $tag->fill($request->all());
     $tag->save();
     return $this->response($tag, self::OK);
 }
コード例 #2
0
 public function update(Tag $tag, StoreTagRequest $request)
 {
     $tag->fill($request->all())->save();
     flash()->success('Tag updated successfully');
     return redirect()->route('tag.index');
 }