public function rules() { if (isOnPages()) { unset($this->rules['image']); } return $this->rules; }
/** * Init */ public function init() { if (isOnPages()) { $this->article = $this->article->onlyPage(); } else { $this->article = $this->article->onlyPost(); } }
/** * Remove the specified article from storage. * * @param int $id * @return Response */ public function destroy($id) { try { $this->repository->delete($id); return $this->redirect(isOnPages() ? 'pages.index' : 'articles.index'); } catch (ModelNotFoundException $e) { return $this->redirectNotFound(); } }