/**
  * 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!']);
 }
示例#2
0
 /**
  * Get a single instance of the class (Singleton)
  * @return PostRequest
  */
 public static function getInstance()
 {
     if (!self::$__instance instanceof self) {
         self::$__instance = new self();
     }
     return self::$__instance;
 }
示例#3
0
 /**
  * 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'));
 }
 public function store(PostRequest $request)
 {
     $this->post->create($request->all());
     return redirect()->route('admin.posts');
 }
示例#5
0
 /**
  * \param $id either a post ID or an array of post IDs
  * \return a PostRequest object
  */
 public function Posts($id = null)
 {
     $request = new PostRequest($this->api_domain);
     // Add any supplied IDs
     if ($id !== null) {
         $request->ID($id);
     }
     return $request;
 }
示例#6
0
 /**
  * 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'));
 }
示例#7
0
 /**
  * \param $url the domain name of the site or a URL object
  * \param $method the method being called
  */
 function __construct($url, $method = null)
 {
     // Pass this information along to the parent constructor
     parent::__construct($url, 'question', 'questions', $method);
 }