public function run() { TypeNew::create(['name' => 'Giói thiệu', 'slug' => 'gioi-thieu']); TypeNew::create(['name' => 'About-us', 'slug' => 'about-us']); TypeNew::create(['name' => 'Tuyển dụng', 'slug' => 'tuyen-dung']); TypeNew::create(['name' => 'Carrier', 'slug' => 'carrier']); }
public function showChildSlug($slug, $childSlug) { $type = TypeNew::findBySlug($slug); $typeName = $type->name; $data = AdminNew::findBySlug($childSlug); $related = AdminNew::where('type_new_id', $data->type_new_id)->whereNotIn('id', [$data->id])->orderBy('id', 'desc')->limit(PAGINATE_RELATED)->get(); return View::make('site.news.showNews')->with(compact('data', 'related', 'typeName', 'slug')); }
public function sendLang() { $input = Input::all(); if ($input['lang'] == $input['lang_current']) { return $input['url']; } else { if ($input['lang_current'] == 'vi') { if ($input['link_url'] == 'gioi-thieu') { return url('/en/about'); } if ($input['link_url'] == 'lien-he') { return url('/en/contact'); } if (!empty($input['link_url'])) { $type = TypeNew::findBySlug($input['link_url']); if (!empty($type)) { $obj = Common::objectLanguage2('TypeNew', $type->id, LANG_VI); $slug = $obj->slug; } } else { $slug = ''; } if (!empty($input['link_url2'])) { $news = AdminNew::findBySlug($input['link_url2']); if (!empty($news)) { $obj = Common::objectLanguage2('AdminNew', $news->id, LANG_VI); $slugChild = $obj->slug; } } else { $slugChild = ''; } return url('/en/' . $slug . '/' . $slugChild); } if ($input['lang_current'] == 'en') { if ($input['link_url'] == 'about') { return url('/vi/gioi-thieu'); } if ($input['link_url'] == 'contact') { return url('/vi/lien-he'); } if (!empty($input['link_url'])) { $type = TypeNew::findBySlug($input['link_url']); if (!empty($type)) { $obj = Common::objectLanguage2('TypeNew', $type->id, LANG_EN); $slug = $obj->slug; } } else { $slug = ''; } if (!empty($input['link_url2'])) { $news = AdminNew::findBySlug($input['link_url2']); if (!empty($news)) { $obj = Common::objectLanguage2('AdminNew', $news->id, LANG_EN); $slugChild = $obj->slug; } } else { $slugChild = ''; } return url('/vi/' . $slug . '/' . $slugChild); } } }