/** * Bootstrap the application services. * * @return void */ public function boot() { view()->composer('*', function ($view) { if (current_lang_id() == 1) { $view->with('slides', \App\Slide::where('slider_id', 62)->orderBy('order', 'asc')->get()); } else { $view->with('slides', \App\Slide::where('slider_id', 44)->orderBy('order', 'asc')->get()); } }); }
public function search(Request $request) { $hour_from = "00:01"; $hour_to = "23:59"; $cond = ''; $data = $request->all(); if ($data['from-date'] != null) { $time_from = $this->convert_datetime($data['from-date'], $hour_from); $cond .= 'tours.start_date >= ' . $time_from . ' and '; } if ($data['to-date'] != null) { $time_to = $this->convert_datetime($data['to-date'], $hour_from); $cond .= 'tours.start_date <= ' . $time_to . ' and '; } if ($data['price'] != 0) { switch ($data['price']) { case 1: $cond .= 'tours.price < 3000000 and'; break; case 2: $cond .= 'tours.price >= 3000000 and tours.price < 7000000 and '; break; case 3: $cond .= 'tours.price >= 7000000 and tours.price < 12000000 and '; break; case 4: $cond .= 'tours.price >= 12000000 and tours.price < 15000000 and '; break; case 5: $cond .= 'tours.price >= 20000000 and tours.price < 30000000 and '; break; case 6: $cond .= 'tours.price >= 30000000 and'; break; } } $cond .= 'tours.start_id = ' . $data['start_place']; $in_ids = DB::select("\n select tour_id\n from tour_place\n where place_id = " . $data['end_place'] . "\n "); $list_id = []; $i = 0; foreach ($in_ids as $in_id) { $list_id[$i] = $in_id->tour_id; $i++; } $ids = join(',', $list_id); if ($ids != null) { $tour_out = DB::select("select tours.*,\n tours_lang.name,tours_lang.desc\n \t from tours_lang\n\t\tjoin (select * from tours\n\t\twhere id in ({$ids})) as tours on tours_lang.tour_id = tours.id\n\t\tWHERE tours_lang.lang_id =" . current_lang_id() . "\n and " . $cond . "\n "); } else { $tour_out = []; } return view('frontend.tour.search', compact('tour_out')); }
public function confirm($key, $id) { $subs = Subscribe::find($id); if ($subs) { if ($subs->key_active == $key) { $subs->status = 'confirmed'; $subs->update(); if (current_lang_id() == 1) { return view('template.statusconfirm', ['status' => 'Bạn đã xác nhận thành công <a href="' . url() . '">Bấm vào đây</a> để quay về trang chủ']); } else { return view('template.statusconfirm', ['status' => 'Your registration is successfull completed <a href="' . url() . '">Click here</a> to return to home page']); } } else { return view('template.statusconfirm', ['status' => 'Có lỗi xảy ra, Vui lòng thử lại sau']); } } else { return 'Not found'; } }
public function listAll($lang_id, $has_name = false) { $lang_id = $lang_id ? $lang_id : current_lang_id(); return $this->model->where('lang_id', $lang_id)->lists('name', 'status_id')->toArray(); }
public function getHotel($city_id) { $city = DB::table('hotels as h')->join('hotel_lang as hl', 'hl.object_id', '=', 'h.id')->where('hl.lang_id', current_lang_id())->where('hl.lang_type', 'App\\Model\\Hotel')->where('h.id', $city_id)->select('h.id', 'hl.name', 'hl.hotel_lang_id', 'hl.lang_type')->get(); return $city; }
<section id="box-slide"> @yield('box-slide') </section> <section id="news-rooms"> @yield('news-rooms') </section> <section id="main-body"> @yield('main-body') </section> <footer id="footer"> <div class="container"> <div class="row"> <?php $langid = current_lang_id(); ?> <div class="col-sm-6 col-md-3 ftcol"> <h3 class="title">{!! get_setting('ft_addr', $langid) !!}</h3> <div> {!! get_setting('ft_phone', $langid) !!} </div> </div> <div class="col-sm-6 col-md-3 ftcol"> <h3 class="title">{!! get_setting('ftl_addr', $langid) !!}</h3> <div> {!! get_setting('ftl_phone', $langid) !!} </div> </div>
public function storeCt(Request $request) { $valid = \Validator::make($request->all(), ['name' => 'required', 'email' => 'required|email', 'content' => 'required']); if ($valid->fails()) { return redirect()->back()->withErrors($valid)->withInput(); } else { $contact = new Comment(); $contact->author_name = $request->input('name'); if ($request->input('receive_reply') == 1) { $rep = "Có"; } else { $rep = 'Không'; } $content = 'Lý do :' . $request->input('reason_contact') . '<br /> Điện thoại: ' . $request->input('phone') . ' ' . 'Email: ' . $request->input('email') . '<br />' . '<p>Nội dung :' . $request->input('content') . '</p> Nhận hồi âm: ' . $rep; $contact->content = $content; $contact->reason_contact = $request->input('reason_contact'); $contact->receive_reply = $request->input('receive_reply'); $contact->type = 'contact'; if ($contact->save()) { if (current_lang_id() == 1) { return redirect()->back()->with('Mess', 'Nội dung của bạn đã được gưi, chúng tôi sẽ sớm phản hồi cho bạn !'); } else { return redirect()->back()->with('Mess', 'Your content has been submitted, we will soon get back to you !'); } } else { return redirect()->back()->with('errorMess', 'Có lỗi xảy ra, vui lòng thử lại sau!'); } } }
?> <a href="{{get_setting('_link')}}"><img src="{{get_setting('_popup_image')}}" /></a> <?php } else { ?> <a href="{{get_setting('_link_en')}}"><img src="{{get_setting('_popup_image_en')}}" /></a> <?php } ?> <button class="pclose"><i class="fa fa-2x fa-close"></i> </button> </div> <?php if (current_lang_id() == 1) { if (get_setting('_popup_image') != null) { ?> <script> (function($){ var pimage = $('#popup_image'); setTimeout(function(){ pimage.fadeIn(500); }, 2000); setTimeout(function(){ pimage.fadeOut(500); }, parseInt(<?php echo get_setting("_popup_delay"); ?> )*1000);
Route::resource('menu', 'MenuController', ['names' => $resourceNames('menu')]); Route::post('menu/massdel', ['as' => 'menu.massdel', 'uses' => 'MenuController@massdel']); Route::get('/menu/{id}/menu-item', ['as' => 'menu-item', 'uses' => 'MenuController@itemIndex']); Route::group(['prefix' => 'menuitem'], function () { Route::get('/{group_id}/create', ['as' => 'menuitem.create', 'uses' => 'MenuController@itemCreate']); Route::post('/store', ['as' => 'menuitem.store', 'uses' => 'MenuController@itemStore']); Route::get('/{id}/edit/{group_id}', ['as' => 'menuitem.edit', 'uses' => 'MenuController@itemEdit']); Route::put('/update/{id}', ['as' => 'menuitem.update', 'uses' => 'MenuController@itemUpdate']); Route::get('/{id}/delete/{group_id}', ['as' => 'menuitem.delete', 'uses' => 'MenuController@itemDelete']); Route::post('/massdel', ['as' => 'menuitem.massdel', 'uses' => 'MenuController@itemMassdel']); }); //Subscribe Manage Route::get('subscribe/delete/{id}', ['as' => 'subs.delete', 'uses' => 'CustomerInfoController@destroy']); Route::resource('subscribe', 'CustomerInfoController', ['names' => $resourceNames('subs')]); Route::post('subscribe/sendmail', ['as' => 'subs.sendmail', 'uses' => 'CustomerInfoController@sendMail']); Route::post('subscribe/massdel', ['as' => 'subs.massdel', 'uses' => 'CustomerInfoController@massdel']); Route::get('subscribe/createmail/{id}', ['as' => 'subs.createmail', 'uses' => 'CustomerInfoController@createMail']); }); Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); Route::get('test_mb', function () { return view('test_mb'); }); Route::get('paypal/success', 'BookingController@paypal'); Route::get('paypal/cancel', 'BookingController@paypalCancel'); Route::get('/location', function () { return view('template.location'); }); Route::get('/flight-schedule', function () { $list_schedule = DB::table('menus')->join('menu_desc', 'menus.id', '=', 'menu_desc.menu_id')->where('menu_desc.lang_id', current_lang_id())->where('menus.parent', 33)->select('menu_desc.name', 'menu_desc.link')->get(); return view('template.flight-schedule', compact('list_schedule')); });
public function change_pay(Request $request) { $payment = $request->all(); if ($payment['total_pay'] > 0) { DB::table('bookings')->where('id', $payment['id'])->update(['status' => $payment['status'], 'total_pay' => $payment['total_pay']]); } else { DB::table('bookings')->where('id', $payment['id'])->update(['status' => $payment['status']]); } if ($payment['status'] == 1) { $data = Booking::where('id', $payment['id'])->get(); $data_out = $data[0]; $service_out = []; $key = 0; $service_bf = 0; $service_af = 0; $services = DB::table('service_lang')->join('services', 'service_lang.service_id', '=', 'services.id')->where('service_lang.lang_id', current_lang_id())->select('service_lang.*', 'services.*')->get(); foreach ($services as $service) { if ($service->choice == 0) { $service_out[$key]['name'] = $service->name; if ($service->option == 0) { $ser_bf = $data_out['total_room'] * $service->value / 100; $service_bf += $ser_bf; $service_out[$key]['money'] = $ser_bf; } else { $service_bf += $service->value; $service_out[$key]['money'] = $service->value; } $key++; } } foreach ($services as $service) { if ($service->choice == 1) { $service_out[$key]['name'] = $service->name; if ($service->option == 0) { $ser_af = ($data_out['total_room'] + $service_bf) * $service->value / 100; $service_af += $ser_af; $service_out[$key]['money'] = $ser_af; } else { $service_af += $service->value; $service_out[$key]['money'] = $service->value; } $key++; } } if ($payment['total_pay'] > 0) { $data_out['total_payed'] = $payment['total_pay']; } //$service_out = array_reverse($service_out); if ($data_out->lang_id == 1) { Mail::send('emails.confirm_booking', ['data' => $data_out, 'services' => $service_out], function ($message) use($data_out) { $message->to($data_out['emails'], 'VATC SlepPod')->from('*****@*****.**')->subject('VATC SlepPod Xác nhận đặt phòng'); }); Mail::send('emails.confirm_booking', ['data' => $data_out, 'services' => $service_out], function ($message) use($data_out) { $message->to('*****@*****.**', 'VATC SlepPod')->from('*****@*****.**')->subject('VATC SlepPod Xác nhận đặt phòng'); }); if (!is_null($data_out['guest_email']) && $data_out['guest_email'] != '') { Mail::send('emails.confirm_booking', ['data' => $data_out, 'services' => $service_out], function ($message) use($data_out) { $message->to($data_out['guest_email'], 'VATC SlepPod')->from('*****@*****.**')->subject('VATC SlepPod Xác nhận đặt phòng'); }); } } else { Mail::send('emails.confirm_booking-en', ['data' => $data_out, 'services' => $service_out], function ($message) use($data_out) { $message->to($data_out['emails'], 'VATC SlepPod')->from('*****@*****.**')->subject('VATC SLEEPPOD BOOKING CONFIRMATION'); }); Mail::send('emails.confirm_booking', ['data' => $data_out, 'services' => $service_out], function ($message) use($data_out) { $message->to('*****@*****.**', 'VATC SlepPod')->from('*****@*****.**')->subject('VATC SlepPod Xác nhận đặt phòng'); }); if (!is_null($data_out['guest_email']) && $data_out['guest_email'] != '') { Mail::send('emails.confirm_booking-en', ['data' => $data_out, 'services' => $service_out], function ($message) use($data_out) { $message->to($data_out['guest_email'], 'VATC SlepPod')->from('*****@*****.**')->subject('VATC SLEEPPOD BOOKING CONFIRMATION'); }); } } } return Redirect::back(); }
public function index() { $items = $this->status->all(current_lang_id()); $data = ['title' => 'Danh sách trạng thái', 'items' => $items]; return view('backend.status.index', $data); }
public function withlang($lang_id = null) { $lang_id = $lang_id == null ? current_lang_id() : $lang_id; return $this->where('lang_id', $lang_id)->first(); }
public function bookingConfirm(Request $request) { $validator = Validator::make($request->all(), ['name' => 'required|max:255', 'address' => 'required|max:255', 'mobile' => 'required', 'email' => 'required|email']); if ($validator->fails()) { return 'fail'; } else { $data = $request->all(); $tour = Tour::findOrFail($data['tour_id']); DB::beginTransaction(); try { $booking_tour = new BookingTour(); $booking_tour->tour_id = $data['tour_id']; $booking_tour->lang_id = current_lang_id(); $booking_tour->fullname = $data['name']; $booking_tour->email = $data['email']; $booking_tour->phone = $data['phone']; $booking_tour->mobile = $data['mobile']; $booking_tour->address = $data['address']; $booking_tour->status = 0; $booking_tour->note = $data['note']; $booking_tour->adult = $data['adult']; $booking_tour->child = $data['child']; $booking_tour->baby = $data['baby']; $booking_tour->method_payment = $data['payment_type']; $booking_tour->total_money = 0; $booking_tour->time_book = time(); $data['time_book'] = time(); $data['deadline_book'] = $data['time_book'] + 24 * 60 * 60; $booking_tour->save(); $total_money = 0; $total_single = 0; foreach ($data['cus'] as $key => $cus) { $total_per = 0; $customer = new CustomerTour(); $customer->booking_id = $booking_tour->id; $customer->fullname = $cus['full_name']; $customer->birthday = $cus['date_birth']; $customer->gender = $cus['gender']; $customer->type_person = $cus['type_person']; $customer->nationality = $cus['nationality']; $customer->passport = $cus['passport']; $customer->deadline = $cus['deadline']; $customer->single_room = $cus['single_room']; if ($cus['single_room'] == 1) { $total_single++; $total_per = $tour->price_single; } switch ($customer->type_person) { case 0: $customer->total_per = $total_per + $tour->price; $total_money += $tour->price; break; case 1: $customer->total_per = $total_per + $tour->price_child; $total_money += $tour->price_child; break; case 2: $customer->total_per = $total_per + $tour->price_baby; $total_money += $tour->price_baby; break; } $data['cus'][$key]['total_per'] = $customer->total_per; $customer->save(); } $year = date('Y', time()); $month = date('m', time()); $day = date('d', time()); $year = $year - 2010; $month = str_pad($month, 2, "0", STR_PAD_LEFT); $day = str_pad($day, 2, "0", STR_PAD_LEFT); $id_book = str_pad($booking_tour->id, 4, "0", STR_PAD_LEFT); $booking_code = $year . $month . $day . $id_book; $booking_tour->booking_code = $booking_code; $booking_tour->total_money = $total_money + $total_single * $tour->price_single; $booking_tour->update(); $data['total_single'] = $total_single; $data['total_money'] = $booking_tour->total_money; $data['booking_code'] = $booking_code; } catch (Exception $e) { DB::rollBack(); return redirect()->back()->withInput()->with('errorMess', 'Có lỗi xảy ra!'); } DB::commit(); $tour_show = DB::table('tours')->join('tours_lang', 'tours.id', '=', 'tours_lang.tour_id')->join('country_lang', 'country_lang.country_id', '=', 'tours.start_id')->where('country_lang.lang_type', 'App\\Model\\Province')->where('tours_lang.lang_id', current_lang_id())->where('country_lang.lang_id', current_lang_id())->where('tours.id', $data['tour_id'])->select('tours.*', 'tours_lang.name', 'country_lang.name as start_place')->get(); $tour = $tour_show[0]; return view('frontend.tour.confirm', compact('tour', 'data')); } }
function place_out() { $place_out = DB::table('country_lang')->join('provincial', 'provincial.id', '=', 'country_lang.country_id')->where('country_lang.lang_id', current_lang_id())->where('country_lang.lang_type', 'App\\Model\\Province')->select('provincial.id', 'country_lang.name')->get(); return $place_out; }
public function showAirport() { $posts = DB::table('posts')->join('cat_post', 'cat_post.post_id', '=', 'posts.id')->join('post_desc', 'post_desc.post_id', '=', 'posts.id')->where('cat_post.cat_id', 65)->whereNotNull('post_desc.post_title')->where('post_desc.post_title', '!=', '')->where('post_desc.lang_id', current_lang_id())->orderBy('posts.created_at', 'desc')->paginate(get_setting('_per_page')); $data = ['cat' => $this->cat->findItem(65), 'posts' => $posts]; return view('cat.show', $data); }
public function index(Request $request) { $args = ['orderby' => $request->has('orderby') ? $request->get('orderby') : 'key', 'order' => $request->has('order') ? $request->get('order') : 'asc', 'key' => $request->has('key') ? $request->get('key') : null]; $data = ['title' => 'Quản lý Options', 'items' => fOption::all(current_lang_id(), $args), 'menugroups' => $this->tax->listType('menugroup', 0, true), 'sliders' => $this->tax->listType('slider', 0, true), 'banners' => $this->tax->listType('banner', 0, true)]; return view('backend.option.index', $data); }