/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $generator = \Faker\Factory::create('vi_VN');
     $value = 'Banner Chính 1';
     $navigation = Navigation::create(['key' => Common::createKeyURL($value), 'navigation_category_id' => 1, 'priority' => 0, 'is_publish' => 1, 'created_by' => 'phantsang', 'updated_by' => 'phantsang']);
     NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $value, 'summary' => $value]);
     Attachment::create(['entry_id' => $navigation->id, 'table_name' => 'navigations', 'path' => $generator->imageUrl($width = 1269, $height = 820), 'priority' => 0, 'is_publish' => 1]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $generator = \Faker\Factory::create('vi_VN');
     $value = 'Banner Chính 1';
     $navigation = Navigation::create(['key' => Common::createKeyURL($value), 'navigation_category_id' => 1, 'priority' => 0, 'is_publish' => 1, 'created_by' => 'phantsang', 'updated_by' => 'phantsang']);
     NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $value, 'summary' => $value]);
     Attachment::create(['entry_id' => $navigation->id, 'table_name' => 'navigations', 'path' => $generator->imageUrl($width = 1269, $height = 820), 'priority' => 0, 'is_publish' => 1]);
     // BANNER SOCIAL
     $navigationCategory = NavigationCategory::findByKey('banner-social')->first()->id;
     for ($i = 1; $i <= 3; $i++) {
         $navigation_name = $generator->sentence($nbWords = 6);
         $navigation = Navigation::create(['key' => Common::createKeyURL($navigation_name), 'navigation_category_id' => $navigationCategory, 'priority' => $i, 'is_publish' => 1, 'created_by' => 'phantsang', 'updated_by' => 'phantsang']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $navigation_name, 'summary' => $generator->text($maxNbChars = 50), 'content' => '']);
         Attachment::create(['entry_id' => $navigation->id, 'table_name' => 'navigations', 'path' => '/uploads/social' . $i . '.png', 'priority' => 0, 'is_publish' => 1]);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('home', ['title' => 'Home', 'navigation' => Navigation::all()]);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     DB::transaction(function () use($id) {
         $user = Auth::user();
         $navigation = Navigation::findOrFail($id);
         $navigation->updated_by = $user->name;
         $navigation->deleted_by = $user->name;
         $navigation->key = $navigation->key . '-' . microtime(true);
         $navigation->save();
         // soft delete
         $navigation->delete();
     });
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Liên kết slider chính trang chủ
     $navigationCategories_homepage_id = NavigationCategory::findByKey('banner-trang-chu')->first()->id;
     $home_main_navigation_name = ['Khuyến mại sốc đầu xuân mới 2016', 'Cloud VPS siêu tiết kiệm', 'Tăng tốc website với CDN'];
     $home_main_navigation_summary = ['Khuyến mại sốc đầu xuân mới 2016', 'Cloud VPS siêu tiết kiệm', 'Tăng tốc website với CDN'];
     $home_main_navigation_content_templates = ['home_page_tinh-tien-theo-gio.html', 'home_page_khoi-tao-cuc-nhanh.html', 'home_page_chong-ddos.html'];
     $home_banner_navigation_attachments = ['/uploads/banner1.jpg', '/uploads/banner2.jpg', '/uploads/banner3.jpg'];
     foreach ($home_main_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $navigationCategories_homepage_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $home_main_navigation_summary[$key]]);
         Attachment::create(['entry_id' => $navigation->id, 'table_name' => 'navigations', 'path' => $home_banner_navigation_attachments[$key], 'priority' => $key, 'is_publish' => 1]);
     }
     // Liên kết slider customer trang chủ
     $navigationCategories_customer_id = NavigationCategory::findByKey('khach-hang-tieu-bieu')->first()->id;
     $home_customer_navigation_name = ['VietDesigner', 'MKO', '24h', 'CGV', 'Ygame'];
     $home_customer_navigation_attachments = ['/frontend/img/vietdesigner.png', '/frontend/img/MKO.png', '/frontend/img/24h.png', '/frontend/img/CGV.png', '/frontend/img/ygame.png'];
     $home_customer_navigation_content = ['<img alt="" src="/frontend/img/vietdesigner.png">', '<img alt="" src="/frontend/img/MKO.png">', '<img alt="" src="/frontend/img/24h.png">', '<img alt="" src="/frontend/img/CGV.png">', '<img alt="" src="/frontend/img/ygame.png">'];
     foreach ($home_customer_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $navigationCategories_customer_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => '', 'content' => $home_customer_navigation_content[$key]]);
         Attachment::create(['entry_id' => $navigation->id, 'table_name' => 'navigations', 'path' => $home_customer_navigation_attachments[$key], 'priority' => $key, 'is_publish' => 1]);
     }
     // Liên kết slider chính trang MÁY CHỦ VPS
     $vps_service_navigationCategories_id = NavigationCategory::findByKey('banner-may-chu')->first()->id;
     $vps_service_navigation_name = ['Tính Tiền Theo Giờ', 'Khởi Tạo Cực Nhanh', 'Chống DDos', 'Dễ dàng & Linh hoạt'];
     $vps_service_navigation_summary = ['Dùng bao nhiêu, trả bấy nhiêu', 'Máy chủ sẵn sàng sau 30s', 'An toàn là trên hết', 'Tất cả đều có thể thao tác trên website'];
     $vps_service_navigation_content_templates = ['vps_service_tinh-tien-theo-gio.html', 'vps_service_khoi-tao-cuc-nhanh.html', 'vps_service_chong-ddos.html', 'vps_service_de-dang-linh-hoat.html'];
     foreach ($vps_service_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $vps_service_navigationCategories_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $vps_service_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $vps_service_navigation_content_templates[$key])]);
     }
     // Liên kết slider chính trang EMAIL SERVER
     $email_server_navigationCategories_id = NavigationCategory::findByKey('banner-email-server')->first()->id;
     $email_server_navigation_name = ['Nâng tầm doanh nghiệp', 'An toàn và linh hoạt', 'Dễ dàng thanh toán', 'Dual Xeon 5620'];
     $email_server_navigation_summary = ['Cloudone mang tới bạn dịch vụ E-mail chuyên nghiệp', 'Sử dụng an toàn và linh hoạt', 'Thanh toán linh hoạt, dễ dàng và tiện ích', 'Dual Xeon 5620 summary'];
     $email_server_navigation_content_templates = ['email_server_slider_1.html', 'email_server_slider_2.html', 'email_server_slider_3.html', 'email_server_slider_4.html'];
     foreach ($email_server_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $email_server_navigationCategories_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $email_server_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $email_server_navigation_content_templates[$key])]);
     }
     // Liên kết slider chính trang DỊCH VỤ HOSTING
     $hosting_service_navigationCategories_id = NavigationCategory::findByKey('banner-hosting')->first()->id;
     $hosting_service_navigation_name = ['WEB Hosting', 'Hệ thống máy chủ hiện đại, ổn định', 'Thanh toán tiện lợi', 'Thân thiện'];
     $hosting_service_navigation_summary = ['Quản lý 1 cách đơn giản trên web', 'Chi phí hợp lý, gói dịch vụ linh hoạt', 'Thanh toán linh hoạt, dẽ dàng và tiện ích', 'Hệ thống quản lý thân thiện, dễ sử dụng'];
     $hosting_service_navigation_content_templates = ['hosting_service_slider_1.html', 'hosting_service_slider_2.html', 'hosting_service_slider_3.html', 'hosting_service_slider_4.html'];
     foreach ($hosting_service_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $hosting_service_navigationCategories_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $hosting_service_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $hosting_service_navigation_content_templates[$key])]);
     }
     // Liên kết slider chính trang DỊCH VỤ DOMAIN
     $domain_service_navigationCategories_id = NavigationCategory::findByKey('banner-ten-mien')->first()->id;
     $domain_service_navigation_name = ['Lựa chọn đơn giản', 'Domain Slider 2', 'Domain Slider 3', 'Domain Slider 4'];
     $domain_service_navigation_summary = ['Đăng ký nhanh gọn, chuyển đổi đơn giản', 'Slider 2 summary', 'Slider 3 summary', 'Slider 4 summary'];
     $domain_service_navigation_content_templates = ['domain_service_slider_1.html', 'domain_service_slider_2.html', 'domain_service_slider_3.html', 'domain_service_slider_4.html'];
     foreach ($domain_service_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $domain_service_navigationCategories_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $domain_service_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $domain_service_navigation_content_templates[$key])]);
     }
     // Liên kết slider chính trang DỊCH VỤ CDN
     $cdn_service_navigationCategories_id = NavigationCategory::findByKey('banner-cdn')->first()->id;
     $cdn_service_navigation_name = ['CDN System', 'CDN, xu thế mới', 'Siêu tốc', 'Cdn Slider 4'];
     $cdn_service_navigation_summary = ['Slider 1 summary', 'Slider 2 summary', 'Thiết lập nhanh chóng, dễ dàng và an toàn', 'Slider 4 summary'];
     $cdn_service_navigation_content_templates = ['cdn_service_slider_1.html', 'cdn_service_slider_2.html', 'cdn_service_slider_3.html', 'cdn_service_slider_4.html'];
     foreach ($cdn_service_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $cdn_service_navigationCategories_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $cdn_service_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $cdn_service_navigation_content_templates[$key])]);
     }
     // Liên kết slider chính trang DỊCH VỤ WEBSITE
     $website_service_navigationCategories_id = NavigationCategory::findByKey('banner-website')->first()->id;
     $website_service_navigation_name = ['Hiện đại, Nhanh chóng, tiện lợi', 'An toàn, linh hoạt', 'Thanh toán linh hoạt, dẽ dàng và tiện ích', 'Website Slider 4'];
     $website_service_navigation_summary = ['Hiện đại, Nhanh chóng, tiện lợi', 'Sử dụng an toàn và linh hoạt', 'Thanh toán linh hoạt, dẽ dàng và tiện ích', 'Website Slider 4 summary'];
     $website_service_navigation_content_templates = ['website_service_slider_1.html', 'website_service_slider_2.html', 'website_service_slider_3.html', 'website_service_slider_4.html'];
     foreach ($website_service_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $website_service_navigationCategories_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $website_service_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $website_service_navigation_content_templates[$key])]);
     }
     // Liên kết slider chính landingpage
     $navigationCategories_landingpage_id = NavigationCategory::findByKey('banner-landing-page')->first()->id;
     $home_main_navigation_name = ['VPS Tính Tiền Theo Giờ Landing Page', 'Chúc mừng năm mới 2016 Landing Page', 'Tiện ích vượt trội Landing Page', 'Dễ dàng & Linh hoạt Landing Page'];
     $home_main_navigation_summary = ['Dùng bao nhiêu, trả bấy nhiêu', 'Dich vụ ưu đãi, chất lượng đầu năm', 'Dịch vụ chuyên nghiệp', 'Tất cả đều có thể thao tác trên website'];
     $home_main_navigation_content_templates = ['home_page_tinh-tien-theo-gio.html', 'home_page_khoi-tao-cuc-nhanh.html', 'home_page_chong-ddos.html', 'home_page_de-dang-linh-hoat.html'];
     foreach ($home_main_navigation_name as $key => $name) {
         $navigation = Navigation::create(['key' => Common::createKeyURL($name), 'navigation_category_id' => $navigationCategories_landingpage_id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         NavigationTranslation::create(['navigation_id' => $navigation->id, 'locale' => 'vi', 'name' => $name, 'summary' => $home_main_navigation_summary[$key], 'content' => file_get_contents(base_path() . '\\public\\templates\\navigations\\' . $home_main_navigation_content_templates[$key])]);
     }
 }