コード例 #1
0
 /**
  * Update the specified resource in storage.
  * @param $id
  * @internal param $post
  * @return Response
  */
 public function update($id)
 {
     $record = $this->blogRepository->findById($id);
     $val = $this->blogRepository->getEditForm($id);
     if (!$val->isValid()) {
         return Redirect::back()->with('errors', $val->getErrors())->withInput();
     }
     if (!$this->blogRepository->update($id, $val->getInputData())) {
         return Redirect::back()->with('errors', $this->blogRepository->errors())->withInput();
     }
     $tags = is_array(Input::get('tags')) ? array_filter(Input::get('tags')) : [];
     $this->tagRepository->attachTags($record, $tags);
     return Redirect::action('AdminBlogsController@edit', $id)->with('success', 'Updated');
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($id)
 {
     $event = $this->eventRepository->findById($id);
     $val = $this->eventRepository->getEditForm($id);
     if (!$val->isValid()) {
         return Redirect::back()->with('errors', $val->getErrors())->withInput();
     }
     if (Input::get('date_start') > Input::get('date_end')) {
         return Redirect::back()->with('error', 'Event Date Start Cannot be greater than Event End Date');
     }
     if (!$this->eventRepository->update($id, $val->getInputData())) {
         return Redirect::back()->with('errors', $this->eventRepository->errors())->withInput();
     }
     // update the tags
     $tags = is_array(Input::get('tags')) ? array_filter(Input::get('tags')) : [];
     $this->tagRepository->attachTags($event, $tags);
     return Redirect::action('AdminEventsController@index')->with('success', 'Updated');
     //        return Redirect::action('AdminEventsController@edit',$event->id)->with('success', 'Updated');
 }