Beispiel #1
0
 public function destroy($id)
 {
     $sidebar = Sidebar::find($id);
     if ($sidebar === null) {
         return Redirect::to('admin/sidebars')->withStatus('sidebar not found', 'danger');
     }
     $sidebar->delete();
     return Redirect::to('admin/sidebars')->withStatus('Sidebar Deleted');
 }
Beispiel #2
0
 public function edit($id)
 {
     $page = Page::find($id);
     $revisions = DB::table('page_revisions')->where('pageID', $id)->get();
     $pageblocks = DB::table('page_blocks')->where('pageID', $id)->get();
     if ($page === null) {
         return Redirect::to('admin/pages')->withStatus('Page not found', 'danger');
     }
     $layoutfiles = $this->getLayoutFiles();
     $leftSidebars = Sidebar::where('position', 'LIKE', '%Left%')->get();
     $rightSidebars = Sidebar::where('position', 'LIKE', '%Right%')->get();
     return $this->getView()->shares('title', 'Edit Page')->withLayouts($layoutfiles)->withPage($page)->withLeftSidebars($leftSidebars)->withRightSidebars($rightSidebars)->withRevisions($revisions)->withPageBlocks($pageblocks);
 }
Beispiel #3
0
 public function fetch()
 {
     $request = Request::path();
     if ($request == '/') {
         $page = Page::where('id', 1)->first();
     } else {
         $page = Page::where('slug', $request)->where('active', 'Yes')->where('publishedDate', '<=', date('Y-m-d H:i:s'))->first();
     }
     if (empty($page)) {
         return View::make('Error/404')->shares('title', 'Page not found!');
     }
     if (!file_exists(APPDIR . 'Templates/' . $this->template . '/' . $page->layout . '.php')) {
         $page->layout = 'default';
     }
     $this->layout = $page->layout;
     $ids = explode(',', $page->sidebars);
     $leftSidebars = Sidebar::whereIn('id', $ids)->where('position', 'LIKE', '%Left%')->get();
     $rightSidebars = Sidebar::whereIn('id', $ids)->where('position', 'LIKE', '%Right%')->get();
     return View::make('Default')->shares('title', $page->pageTitle)->shares('browserTitle', $page->browserTitle)->shares('leftSidebars', $leftSidebars)->shares('rightSidebars', $rightSidebars)->shares('pageID', $page->id)->withContent($page->content);
 }