/** * Display a listing of the resource. * * @return Response */ public function index() { $viDes = DesContent::find(1); $enDes = DesContent::find(2); $introduces = AdminLanguage::where('model_name', 'Introduce')->orderBy('position', 'asc')->get(); // dd(LaravelLocalization::setLocale()); return View::make('site.index')->with(compact('viDes', 'enDes', 'introduces')); }
public static function getNameEnglish($modelId) { $ob = AdminLanguage::where('model_name', 'AdminNew')->where('model_id', $modelId)->first(); if ($ob) { return AdminNew::find($ob->relate_id)->name; } return null; }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $rules = array('description' => 'required'); $input = Input::except('_token'); $validator = Validator::make($input, $rules); if ($validator->fails()) { return Redirect::action('AdminContactController@edit', $id)->withErrors($validator); } else { $inputUpdateMain = Input::only('description', 'lat', 'long'); $relateUpdateId = Common::getValueLanguage('Contact', $id, 'relate_id'); $inputUpdateRelate['description'] = $input['en_description']; $inputUpdateRelate['lat'] = $input['lat']; $inputUpdateRelate['long'] = $input['long']; CommonNormal::update($id, $inputUpdateMain); CommonNormal::update($relateUpdateId, $inputUpdateRelate); $inputLanguage = Input::only('status'); AdminLanguage::where('model_name', 'Contact')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage); return Redirect::action('AdminContactController@edit', $id); } }
/** * 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')); }
public static function objectLanguage2($modelName, $modelId, $lang) { if ($lang == LANG_VI) { $objectLanguage = AdminLanguage::where('model_name', $modelName)->where('model_id', $modelId)->first(); $relateId = $objectLanguage->relate_id; return $modelName::find($relateId); } if ($lang == LANG_EN) { $objectLanguage = AdminLanguage::where('model_name', $modelName)->where('relate_id', $modelId)->first(); $modelId = $objectLanguage->model_id; return $modelName::find($modelId); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { $data = AdminLanguage::where('model_name', 'AboutUs')->orderBy('id', 'desc')->paginate(PAGINATE); return View::make('admin.about.index')->with(compact('data')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { if (!Admin::isSeo()) { $rules = array('name' => 'required'); $input = Input::except('_token'); $validator = Validator::make($input, $rules); if ($validator->fails()) { return Redirect::action('NewsController@edit', $id)->withErrors($validator)->withInput(Input::except('name')); } else { $inputNews = Input::only('type_new_id', 'name', 'description'); $relateUpdateId = Common::getValueLanguage('AdminNew', $id, 'relate_id'); $inputUpdateRelate['name'] = $input['en_name']; $inputUpdateRelate['description'] = $input['en_description']; $inputUpdateRelate['type_new_id'] = Common::getValueLanguage('TypeNew', Input::get('type_new_id'), 'relate_id'); CommonNormal::update($id, $inputNews); CommonNormal::update($relateUpdateId, $inputUpdateRelate); $inputLanguage = Input::only('position', 'status'); AdminLanguage::where('model_name', 'AdminNew')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage); //update upload image $imageNews = AdminNew::find($id); $input['image_url'] = CommonUpload::uploadImage($id, UPLOADIMG, 'image_url', UPLOAD_NEWS, $imageNews->image_url); CommonNormal::update($id, ['image_url' => $input['image_url']]); CommonNormal::update($relateUpdateId, ['image_url' => $input['image_url']]); } } return Redirect::action('NewsController@index'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $input = Input::all(); $viInput['title'] = $input['title']; $viInput['description'] = $input['description']; $viInput['css'] = $input['css']; $viInput['position'] = $input['position']; CommonNormal::update($id, $viInput); $enInput['title'] = $input['en_title']; $enInput['description'] = $input['en_description']; $enInput['css'] = $input['css']; $enInput['position'] = $input['position']; $en = AdminLanguage::where('model_name', 'Introduce')->where('model_id', $id)->first(); if ($en) { $idEn = $en->relate_id; CommonNormal::update($idEn, $enInput); } return Redirect::action('AdminIntroduceController@index'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $rules = array('name' => 'required', 'position' => 'required|integer|min: 1'); $input = Input::except('_token'); $validator = Validator::make($input, $rules); if ($validator->fails()) { return Redirect::action('NewsTypeController@edit', $id)->withErrors($validator); } else { $inputUpdateMain = Input::only('name', 'position'); $relateUpdateId = Common::getValueLanguage('TypeNew', $id, 'relate_id'); $inputUpdateRelate['name'] = $input['en_name']; $inputUpdateRelate['position'] = $input['position']; CommonNormal::update($id, $inputUpdateMain); CommonNormal::update($relateUpdateId, $inputUpdateRelate); $inputLanguage = Input::only('position', 'status'); AdminLanguage::where('model_name', 'TypeNew')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage); return Redirect::action('NewsTypeController@index'); } }