Esempio n. 1
0
 /**
  * Delete an existing page.
  *
  * @param string $slug
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($slug)
 {
     $page = PageRepository::find($slug);
     $this->checkPage($page, $slug);
     try {
         $page->delete();
     } catch (\Exception $e) {
         return Redirect::route('pages.show', ['pages' => $page->slug])->with('error', 'You cannot delete this page.');
     }
     // write flash message and redirect
     return Redirect::to($this->path)->with('success', 'Your page has been deleted successfully.');
 }
Esempio n. 2
0
 /**
  * Delete an existing page.
  *
  * @param string $slug
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($slug)
 {
     $page = PageRepository::find($slug);
     $this->checkPage($page, $slug);
     try {
         $page->delete();
     } catch (Exception $e) {
         return Redirect::route('pages.show', ['pages' => $page->slug])->with('error', trans('messages.page.delete_error'));
     }
     // write flash message and redirect
     return Redirect::to('pages/home')->with('success', trans('messages.page.delete_success'));
 }