/** * move to trash * * @return \Illuminate\Http\RedirectResponse|Redirect */ public function trash(Request $request) { $documentIds = $request->get('id'); $documentIds = is_array($documentIds) ? $documentIds : [$documentIds]; $items = Board::find($documentIds); foreach ($items as $item) { $this->handler->setModelConfig($item, $this->configHandler->get($item->instanceId)); $this->handler->trash($item, $this->configHandler->get($item->instanceId)); } Session::flash('alert', ['type' => 'success', 'message' => xe_trans('xe::processed')]); return $this->presenter->makeApi([]); }
/** * move to trash * * @return \Illuminate\Http\RedirectResponse|Redirect */ public function trash() { $documentIds = Input::get('id'); $documentIds = is_array($documentIds) ? $documentIds : [$documentIds]; $items = $this->handler->gets(['ids' => $documentIds], []); foreach ($items as $item) { XeDB::beginTransaction(); $this->handler->trash($item, $this->configHandler->get($item->instanceId)); XeDB::commit(); } return $this->presenter->makeApi([]); }
/** * 휴지통 이동 * * @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' => '벌렸습니다.']]); }
/** * 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')]]); }