Пример #1
0
 public function run()
 {
     \Eloquent::unguard();
     \DB::table(\Config::get('vcms5.pages_table'))->delete();
     Page::create(array('page_title' => 'Home', 'page_content' => 'This is the home page.', 'page_title_fr' => 'Accueil', 'page_content_fr' => 'This is the home page in French.', 'page_title_es' => 'Incio', 'page_content_es' => 'This is the home page in Spanish.', 'active' => '1', 'meta' => 'meta', 'slug' => 'home', 'slug_fr' => 'accueil', 'slug_es' => 'incio', 'meta_tags' => 'tags'));
     \DB::table(\Config::get('vcms5.menus_table'))->delete();
     Menu::create(array('menu_name' => 'Main Menu'));
     \DB::table(\Config::get('vcms5.menu_items_table'))->delete();
     MenuItem::create(array('menu_id' => '1', 'menu_text_en' => 'Home', 'menu_text_fr' => 'Home', 'menu_text_es' => 'Home', 'url' => '', 'active' => '1', 'has_children' => '0', 'sort_order' => '1', 'page_id' => '1'));
     \DB::table(\Config::get('vcms5.roles_table'))->delete();
     Role::create(array('id' => '1', 'role_name' => 'Manage Pages', 'role' => 'pages'));
     Role::create(array('id' => '2', 'role_name' => 'Manage Calendar Events', 'role' => 'events'));
     Role::create(array('id' => '3', 'role_name' => 'Manage Blogs', 'role' => 'blogs'));
     Role::create(array('id' => '4', 'role_name' => 'Manage Galleries', 'role' => 'galleries'));
     Role::create(array('id' => '5', 'role_name' => 'Manage Users', 'role' => 'users'));
     Role::create(array('id' => '6', 'role_name' => 'Manage Menus', 'role' => 'menus'));
     Role::create(array('id' => '7', 'role_name' => 'Manage News', 'role' => 'news'));
     Role::create(array('id' => '8', 'role_name' => 'Manage FAQs', 'role' => 'faqs'));
     \DB::table('users')->delete();
     User::create(array('id' => '1', 'email' => '*****@*****.**', 'first_name' => 'Trevor', 'last_name' => 'Sawler', 'password' => \Hash::make('marlow11'), 'user_active' => 1, 'access_level' => 3));
     \DB::table(\Config::get('vcms5.user_roles_table'))->delete();
     UserRole::create(array('id' => '1', 'user_id' => '1', 'role_id' => '1', 'role' => 'pages'));
     UserRole::create(array('id' => '2', 'user_id' => '1', 'role_id' => '2', 'role' => 'events'));
     UserRole::create(array('id' => '3', 'user_id' => '1', 'role_id' => '3', 'role' => 'blogs'));
     UserRole::create(array('id' => '4', 'user_id' => '1', 'role_id' => '4', 'role' => 'galleries'));
     UserRole::create(array('id' => '5', 'user_id' => '1', 'role_id' => '5', 'role' => 'users'));
     UserRole::create(array('id' => '6', 'user_id' => '1', 'role_id' => '6', 'role' => 'menus'));
     UserRole::create(array('id' => '7', 'user_id' => '1', 'role_id' => '7', 'role' => 'news'));
     UserRole::create(array('id' => '8', 'user_id' => '1', 'role_id' => '8', 'role' => 'faqs'));
 }
Пример #2
0
 /**
  * Show the home page
  *
  * @return mixed
  */
 public function showHome()
 {
     $page_title = "Not active";
     $page_content = "Either the page you requested is not active, or it does not exist.";
     $meta = "";
     $meta_keywords = "";
     $active = 1;
     $page_id = 0;
     $results = DB::table('pages')->where('slug', '=', "home")->get();
     foreach ($results as $result) {
         $active = $result->active;
         if ($active > 0 || Auth::check() && Auth::user()->access_level == 3) {
             if (Session::get('lang') == null || Session::get('lang') == "en") {
                 $page_title = $result->page_title;
                 $page_content = $result->page_content;
                 $meta = $result->meta;
                 $page_id = $result->id;
                 $meta_keywords = $result->meta_tags;
                 $fragments = Page::find($result->id)->fragments;
             } else {
                 $page_title = $result->page_title_fr;
                 $page_content = $result->page_content_fr;
                 $meta = $result->meta;
                 $page_id = $result->id;
                 $meta_keywords = $result->meta_tags;
                 $fragments = Page::find($result->id)->fragments;
             }
         }
     }
     return View::make('public.home')->with('page_title', $page_title)->with('page_content', $page_content)->with('meta', $meta)->with('meta_tags', $meta_keywords)->with('active', $active)->with('page_id', $page_id)->with('fragments', $fragments)->with('menu', $this->menu);
 }
Пример #3
0
 public function performSearch()
 {
     if (Input::has('q')) {
         $searchterm = '%' . strtoupper(Input::get('q')) . '%';
         if (Session::get('lang') == "en" || Session::get('lang') == null) {
             $results = Page::whereRaw('page_title like upper(?) or page_content like upper(?)', array($searchterm, $searchterm))->get();
         } else {
             $results = Page::whereRaw('page_title_fr like upper(?) or page_content_fr like upper(?)', array($searchterm, $searchterm))->get();
         }
         if (Session::get('lang') == "en" || Session::get('lang') == null) {
             $news = News::whereRaw('title like upper(?) or news_text like upper(?)', array($searchterm, $searchterm))->get();
         } else {
             $news = News::whereRaw('title_fr like upper(?) or news_text_fr like upper(?)', array($searchterm, $searchterm))->get();
         }
         return View::make('public.search')->with('page_title', 'Search')->with('meta_tags', '')->with('meta', '')->with('searchterm', Input::get('q'))->with('results', $results)->with('news', $news)->with('page_category_id', 1)->with('menu', MenuTrait::getMenu());
     } else {
         return View::make('public.search')->with('page_title', 'Search')->with('searchterm', '')->with('results', [])->with('news', [])->with('page_category_id', 1)->with('menu', MenuTrait::getMenu());
     }
 }
Пример #4
0
 /**
  * Delete a page
  *
  * @return mixed
  */
 public function getDeletePage()
 {
     $item = Page::find(Input::get('id'));
     $item->delete();
     return Redirect::to('/admin/page/all-pages')->with('message', 'Page deleted');
 }