/** * Edit Post * * @return Redirect */ public function postEdit(PostRequest $request, $id) { $command = new EditPostCommand($request->all()); try { $this->bus->execute($command); } catch (ValidationException $e) { return Redirect::to(\OogleeBConfig::get('laravelblog::routes.base_uri_admin') . '/post/{$id}/edit')->withErrors($e->getErrors()); } catch (\DomainException $e) { return Redirect::to(\OogleeBConfig::get('laravelblog::routes.base_uri_admin') . '/post/{$id}/edit')->withErrors($e->getErrors()); } return Redirect::to(\OogleeBConfig::get('laravelblog::routes.base_uri_admin') . '/posts')->with(['message' => 'success!']); }
public function store(PostRequest $request) { $this->post->create($request->all()); return redirect()->route('admin.posts'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update($id, PostRequest $request) { $post = Post::find($id); $post->tags()->detach(); $post->update($request->all()); $post->tags()->attach($request->input('tags')); if ($request->hasFile('thumbnail_link')) { $file = $request->file('thumbnail_link'); $ext = $file->getClientOriginalExtension(); $fileName = $post->slug . '.' . $ext; $file->move('./assets/images/confs', $fileName); $post->thumbnail_link = $fileName; $post->save(); } return redirect()->to('dashboard.dashboard')->with('message', Alert::message('conférence "' . $post->title . '" modifiée avec succès', 'info')); }
/** * Update the specified resource in storage. * * @param App\Http\Requests\PostUpdateRequest $request * @param int $id * @return Response */ public function update(PostRequest $request, $id) { $post = $this->blog_gestion->getById($id); $this->authorize('change', $post); $this->blog_gestion->update($request->all(), $post); return redirect('blog')->with('ok', trans('back/blog.updated')); }