/** * PUT admin/posts/{post} * * @param Post $post * @param PostRequest $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update(Post $post, PostRequest $request) { $post->update($request->all()); if ($request->has('tag_list')) { $post->tags()->sync(Tag::findOrCreateMany($request->get('tag_list'))); } flash()->success('The post has been updated'); return redirect('/admin/posts'); }