public function run()
 {
     TypeAboutUs::create(['name' => 'Giới thiệu', 'name_shadow' => 'về chúng tôi', 'sort' => 1]);
     TypeAboutUs::create(['name' => 'About Us', 'name_shadow' => 'who we are', 'sort' => 1]);
     TypeAboutUs::create(['name' => 'Lịch sử', 'name_shadow' => 'Hành trình', 'sort' => 2]);
     TypeAboutUs::create(['name' => 'Our history', 'name_shadow' => 'Our way', 'sort' => 2]);
     TypeAboutUs::create(['name' => 'Định hướng', 'name_shadow' => 'Triển vọng', 'sort' => 3]);
     TypeAboutUs::create(['name' => 'ORIENTATIONS', 'name_shadow' => 'PROSPECTS', 'sort' => 3]);
     AdminLanguage::create(['model_name' => 'TypeAboutUs', 'model_id' => 1, 'relate_name' => 'TypeAboutUs', 'relate_id' => 2, 'position' => 1, 'status' => 1]);
     AdminLanguage::create(['model_name' => 'TypeAboutUs', 'model_id' => 3, 'relate_name' => 'TypeAboutUs', 'relate_id' => 4, 'position' => 2, 'status' => 2]);
     AdminLanguage::create(['model_name' => 'TypeAboutUs', 'model_id' => 5, 'relate_name' => 'TypeAboutUs', 'relate_id' => 6, 'position' => 3, 'status' => 1]);
 }
Esempio n. 2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $viId = AdminLanguage::where('model_name', 'TypeAboutUs')->lists('model_id');
     $enId = AdminLanguage::where('model_name', 'TypeAboutUs')->lists('relate_id');
     $viData = TypeAboutUs::whereIn('id', $viId)->orderBy('position')->get();
     $enData = TypeAboutUs::whereIn('id', $enId)->orderBy('position')->get();
     // $viData = DB::table('type_about_us')
     // 				->join('languages', 'languages.model_id', '=', 'type_about_us.id')
     // 				->select('type_about_us.id', 'type_about_us.name', 'type_about_us.name_shadow', 'languages.position', 'languages.status')
     // 				->whereNull('type_about_us.deleted_at')
     // 				->distinct()
     // 				->orderBy('languages.position', 'asc')
     // 				->get();
     // $enData = DB::table('type_about_us')
     // 				->join('languages', 'languages.model_id', '=', 'type_about_us.id')
     // 				->select('type_about_us.id', 'type_about_us.name', 'type_about_us.name_shadow', 'languages.position', 'languages.status')
     // 				->whereNull('type_about_us.deleted_at')
     // 				->distinct()
     // 				->orderBy('languages.position', 'asc')
     // 				->get();
     return View::make('site.about.showAbout')->with(compact('viData', 'enData'));
 }