/**
  * trash
  *
  * @param Request $request request
  * @return mixed
  */
 public function trash(Request $request)
 {
     $user = Auth::user();
     $id = $request->get('id');
     $item = $this->handler->getModel($this->config)->find($id);
     $this->handler->setModelConfig($item, $this->config);
     if ($user->getRating() != 'super' && $user->getId() != $item->id) {
         throw new AccessDeniedHttpException();
     }
     $id = $request->get('id');
     $author = Auth::user();
     $item = $this->handler->getModel($this->config)->find($id);
     $this->handler->setModelConfig($item, $this->config);
     // 관리자 또는 본인 글이 아니면 접근 할 수 없음
     if ($author->getRating() !== 'super' && $author->getId() != $item->id) {
         throw new NotFoundDocumentException();
     }
     $this->handler->trash($item, $this->config);
     return redirect()->to($this->urlHandler->get('index'))->with(['alert' => ['type' => 'success', 'message' => xe_trans('xe::complete')]]);
 }
Esempio n. 2
0
 /**
  * 휴지통 이동
  *
  * @return \Illuminate\Http\RedirectResponse|\Xpressengine\Presenter\RendererInterface
  */
 public function trash()
 {
     $id = Input::get('id');
     $author = Auth::user();
     $item = $this->handler->get($id, $this->boardId);
     // 관리자 또는 본인 글이 아니면 접근 할 수 없음
     if ($author->getRating() !== 'super' && $author->getId() != $item->id) {
         throw new NotFoundDocumentException();
     }
     $config = $this->configHandler->get($item->instanceId);
     $item = $this->handler->trash($item, $config);
     // post 로 처리하고.. 이전 페이지로.. 항상 ajax
     return Redirect::to($this->urlHandler->get('index'))->with(['alert' => ['type' => 'success', 'message' => '벌렸습니다.']]);
 }