public function parentName() { $categoryLanguages = \App\CategoryLanguage::where('locale', \Lang::getLocale())->where('category_id', $this->parent_id)->first(); if (!$categoryLanguages) { $categoryLanguages = \App\CategoryLanguage::where('locale', 'en')->where('category_id', $this->parent_id)->first(); } return $categoryLanguages ? $categoryLanguages->title : '-'; }
public function lang() { $locale = $this->pageLocales()->where('locale', \Lang::getLocale()); if ($locale->count() > 0) { $lang = $locale->first(); if ($lang->title != '' && $lang->content != '') { return $lang; } } return $this->pageLocales()->where('locale', 'en')->first(); }
public function categoryName() { if ($this->category) { $categoryLanguages = $this->category->categoryLanguages()->where('locale', \Lang::getLocale()); if ($categoryLanguages->count() > 0) { return $categoryLanguages->first()->title; } else { return $this->category->categoryLanguages()->where('locale', 'en')->first()->title; } } else { return '-'; } }
public function admin_ajax() { $action = Input::get('action'); if ($action == 'menu_link') { $type = Input::get('type'); $item_id = Input::get('item_id'); $link = Input::get('link'); if ($item_id == 0) { $value = $link; } else { $value = $item_id; } switch ($type) { case 'cat': $cats = Lang::where('id', get_default_lang()->id)->with('cats')->first()->cats()->where('type', 'cat')->lists('name', 'id')->toArray(); $output = Form::select('link', $cats, [$value], ['class' => 'form-control']); break; case 'page': $posts = Lang::where('id', get_default_lang()->id)->with('posts')->first()->posts()->where('post_type', 'page')->lists('post_title', 'id'); $output = Form::select('link', $posts, $value, ['class' => 'form-control']); break; case 'post': $posts = Lang::where('id', get_default_lang()->id)->with('posts')->first()->posts()->where('post_type', 'post')->lists('post_title', 'id'); $output = Form::select('link', $posts, $value, ['class' => 'form-control']); break; case 'custom': $output = Form::text('link', $value, ['class' => 'form-control', 'placeholder' => 'http://']); break; default: break; } return $output; } if ($action == 'media_upload') { echo 'media_upload'; } if ($action == 'append_modal') { // $data = [ // 'files' => Post::where('post_type', 'fileimage')->get() // ]; return redirect()->route('file.dialog'); } }
public function __construct() { $this->resortId = 2; $langDefault = Lang::where('name', '=', App::getLocale())->first(); if ($langDefault != NULL) { $this->langId = $langDefault->id; } else { $this->langId = 1; } $accommodationsFooter = Accommodation::with(['contents' => function ($query) { $query->select('accommodation_contents.accommodation_id', 'accommodation_contents.name'); $query->where('lang_id', '=', $this->langId); }])->where('resort_id', $this->resortId)->get(); $resort = Resort::active()->with(['contents' => function ($query) { $query->where('lang_id', '=', $this->langId); }])->where('id', $this->resortId)->first(); //return dd($accommodationsFooter->toArray()); View::share('resort', $resort); View::share('accommodationsFooter', $accommodationsFooter); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($tour) { $langs = get_langs(); foreach ($langs as $lang) { $tour_lang = DB::table('service_lang')->where('service_lang.service_id', $tour['id'])->where('service_lang.lang_id', $lang->id)->get(); $data_out[$lang->code] = $tour_lang[0]; } $tour['lang'] = $data_out; $data = ['lang' => Lang::all(['id', 'lname', 'code']), 'items' => $tour, 'id' => $tour['id']]; return view('backend.service.edit', $data); }
public function getNumOfReviewsAttribute() { return $this->rate_count . ' ' . \Lang::choice('store.review', $this->rate_count); }
public function destroy($id) { $lang = Lang::find($id); if ($lang->delete()) { return redirect()->back()->with('Mess', 'Xóa thành công'); } else { return redirect()->back()->with('errorMess', 'Có lỗi xảy ra, vui lòng thử lại sau'); } }
public function getByName($lang_name) { return Lang::where('code', '=', $lang_name)->get(); }
public function index() { $posts = Lang::where('code', current_lang())->first()->posttype('post')->lists('post_title', 'id')->toArray(); $data = ['columns' => ['id' => 'ID', 'name' => 'Họ tên', 'email' => 'Email', 'status' => 'Trạng thái', 'created_at' => 'Thời gian'], 'items' => Subscribe::orderBy('created_at', 'desc')->paginate(20), 'posts' => $posts]; return view('backend.subscribe.index', $data); }