public function update($id, UpdatePostRequest $request) { $post = Post::find($id); $post->post = $request->get('post'); $post->save(); return redirect()->route('posts.show', $post->id)->with('successes', ['Post updated successfully']); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(\App\Http\Requests\UpdatePostRequest $request, $id) { $post = \App\Post::findOrFail($id); $post->update($request->all()); return redirect()->route('posts.index')->with('status', 'Post Updated!'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(UpdatePostRequest $request, Post $post) { if (Gate::denies('edit', $post)) { abort(403, 'Sorry, not sorry.'); } $post->update($request->all()); $post->tags()->sync(!$request->input('tag_list') ? [] : $request->input('tag_list')); return redirect('posts/' . $post->id); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Requests\UpdatePostRequest $request, $id) { $post = $this->posts->findOrFail($id); $post->fill($request->only('title', 'slug', 'published_at', 'body', 'excerpt'))->save(); return redirect(route('backend.blog.edit', $post->id))->with('status', 'The post has been updated.'); }
/** * Update the specified Post in storage. * * @param int $id * @param UpdatePostRequest $request * * @return Response */ public function update($id, UpdatePostRequest $request) { $post = $this->postRepository->find($id); if (empty($post)) { Flash::error('Post not found'); return redirect(route('posts.index')); } $input = $request->all(); if ($request->file('image')) { $image = $this->uploadImage($request->file('image'), '/posts_photo/'); $input['image'] = $image['resize_url'][0]; } $this->postRepository->updateRich($input, $id); Flash::success('Post updated successfully.'); return redirect(route('posts.index')); }
/** * Update the specified Post in storage. * * @param int $id * @param UpdatePostRequest $request * * @return Response */ public function update($id, UpdatePostRequest $request) { $post = $this->postRepository->find($id); if (empty($post)) { Flash::error('Post not found'); return redirect(route('posts.index')); } $this->postRepository->updateRich($request->all(), $id); Flash::success('Post updated successfully.'); return redirect(route('posts.index')); }