Exemplo n.º 1
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         if (Request::format() == 'html') {
             if (!Auth::check()) {
                 return Redirect::to('/login');
             } else {
                 $this->user_id = Auth::user()->id;
                 $this->zipcode = Session::get('zipcode');
                 $this->store_id = Session::get('store_id');
                 $this->city = City::where('zipcode', $this->zipcode)->first();
                 $this->stores = DB::table('stores')->leftJoin('store_locations', 'stores.id', '=', 'store_locations.store_id')->where('store_locations.zipcode', $this->zipcode)->get();
                 $this->departments = Department::where('store_id', $this->store_id)->get();
                 $this->store = Store::find($this->store_id);
                 $this->cart_id = Session::get('cart_id');
                 // Initialize cart id as well
             }
         } else {
             $this->user_id = Input::get('user_id');
             $token = Input::get('token');
             if (User::where('token', '=', $token)->where('id', $this->user_id)->count() == 0) {
                 $response_array = array('success' => 'false', 'error_code' => '400', 'error' => 'Invalid Token');
                 $response_code = 200;
                 $response = Response::json($response_array, $response_code);
                 return $response;
             }
         }
     }, array('except' => array('login', 'action', 'view_faq', 'sendMail', 'contact', 'verify', 'sendMail', 'save', 'register', 'zipcode', 'social', 'forgot_password', 'shopper_signup', 'shopper_login', 'become_member', 'ApplyHere')));
 }
Exemplo n.º 2
0
 public function index()
 {
     // init
     $data = array();
     // set offset & limit
     $limit = 8;
     $page = Input::has('page') ? Input::get('page') : 1;
     $offset = ($page - 1) * $limit;
     // get all categories
     $data['categories'] = EventCategory::where('status', '=', 1)->get();
     // get all cities
     $data['cities'] = City::where('status', '=', 1)->orderBy('name', 'asc')->get();
     // get input
     $input = Input::all();
     // get social actions
     $events = Events::with(array('city', 'category'))->where('status', '!=', 0);
     if (Input::has('q')) {
         // keyword
         $input['q'] = trim($input['q']);
         $events = $events->where('name', 'like', '%' . $input['q'] . '%');
     }
     if (Input::has('category') and Input::get('category') != 'all') {
         // category
         $events = $events->where('event_category_id', '=', $input['category']);
     }
     if (Input::has('city') and Input::get('city') != 'all') {
         // city
         $events = $events->where('city_id', '=', $input['city']);
     }
     $data['events'] = $events->orderBy('ended_at', 'desc')->paginate($limit);
     // set input
     $data['input'] = $input;
     return View::make('bagikasih.event.index', $data);
 }
Exemplo n.º 3
0
 public function __construct()
 {
     $this->beforeFilter(function () {
         if (Request::format() == 'html') {
             if (!Auth::check()) {
                 return Redirect::to('/login');
             } else {
                 $this->user_id = Auth::user()->id;
                 $this->zipcode = Session::get('zipcode');
                 $this->store_id = Session::get('store_id');
                 $this->cart_id = Session::get('cart_id');
                 $lists = Lists::where('owner_id', $this->user_id)->get();
                 Session::put('lists', $lists);
                 $this->city = City::where('zipcode', $this->zipcode)->first();
                 $this->stores = DB::table('stores')->leftJoin('store_locations', 'stores.id', '=', 'store_locations.store_id')->where('store_locations.zipcode', $this->zipcode)->select('stores.*')->get();
                 $this->departments = Department::where('store_id', $this->store_id)->get();
                 $this->store = Store::find($this->store_id);
             }
         } else {
             $this->user_id = Input::get('user_id');
             $token = Input::get('token');
             if ($user = User::where('token', '=', $token)->where('id', '=', $this->user_id)->first()) {
                 $this->zipcode = $user->zipcode;
             } else {
                 $response_array = array('success' => 'false', 'error_code' => '400', 'error' => 'Invalid Token');
                 $response_code = 200;
                 $response = Response::json($response_array, $response_code);
                 return $response;
             }
         }
     }, array('except' => array()));
 }
Exemplo n.º 4
0
 protected static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $data = array('district_id' => $model->district_id, 'name' => $model->name);
         $rules = array('district_id' => 'required|integer|min:1|max:300000', 'name' => 'required|min:3|max:50');
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             throw new ValidationException(null, null, null, $validator->messages());
         } else {
             return $model->validate();
         }
     });
     static::updating(function ($model) {
         $data = array('district_id' => $model->district_id, 'name' => $model->name);
         $rules = array('district_id' => 'required|integer|min:1|max:300000', 'name' => 'required|min:3|max:50');
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             throw new ValidationException(null, null, null, $validator->messages());
         } else {
             return true;
         }
     });
     static::deleting(function ($model) {
         $cities = City::where('municipality_id', '=', $model->id)->get();
         foreach ($cities as $city) {
             $city = City::find($city->id)->delete();
         }
         return true;
     });
 }
Exemplo n.º 5
0
 public function index()
 {
     $schools = School::all();
     $states = State::all();
     $cities = City::where('state_id', '=', 25)->get();
     $menu = 'data';
     return View::make('schools.index', compact('schools', 'states', 'cities', 'menu'));
 }
Exemplo n.º 6
0
 /**
  * undocumented function
  *
  * @return void
  * @author 
  **/
 public static function isExist($id)
 {
     $count = City::where('country_id', $id)->count();
     if ($count > 0) {
         return true;
     }
     return false;
 }
Exemplo n.º 7
0
 public function postGetCities()
 {
     $country_id = Input::get('country_id');
     $cities = City::where('country_id', '=', $country_id)->get();
     $data_string = "<option value='0'>All</option>";
     foreach ($cities as $item) {
         $data_string .= "<option value='{$item->id}'>{$item->city}</option>";
     }
     return $data_string;
 }
 /**
  * Get all related data to a servidor publico
  */
 public function getServidorProfile($json = true, $servidor_id = false, $viajes = true)
 {
     if ($servidor_id == false && isset(Auth::user()->servidor_id)) {
         $servidorId = Auth::user()->servidor_id;
         $userId = Auth::user()->id;
     } else {
         $servidorId = $servidor_id != false ? $servidor_id : Auth::user()->servidor_id;
         $user = User::where('servidor_id', '=', $servidor_id)->first();
         $userId = $user['id'];
     }
     if (isset($servidorId) && $servidorId > 0) {
         $contact = Servidor::find($servidorId);
         //->first();
         $puesto = Servidor::find($servidorId)->puesto;
         $puesto->remuneracion = Remuneracion::where('id', '=', $puesto->remuneracion_id)->get()->first();
         $cargo = Servidor::find($servidorId)->cargo;
         $unidadAdministrativa = $contact->unidadAdministrativa;
         $numberOfViajes = Viaje::where('servidor_id', '=', $servidorId)->get()->count();
         if ($viajes == true) {
             $viajes = Viaje::where('servidor_id', '=', $servidorId)->get();
             $viajeArray = array();
             foreach ($viajes as $viaje) {
                 $viajeFinal = $viaje;
                 $viajeFinal->tema = $viaje->tema;
                 $viajeFinal->eventos = $viaje->eventos;
                 foreach ($viajeFinal->eventos as $k => $evento) {
                     $viajeFinal->eventos[$k]->pasajes = $evento->pasajes;
                     foreach ($evento->pasajes as $l => $pasaje) {
                         $pasaje->ciudad_origen = City::where('id', '=', $pasaje->ciudad_origen_id)->first();
                         $pasaje->ciudad_destino = City::where('id', '=', $pasaje->ciudad_destino_id)->first();
                         $viajeFinal->eventos[$k]->pasajes[$l]->ciudad_origen = $pasaje->ciudad_origen;
                         $viajeFinal->eventos[$k]->pasajes[$l]->ciudad_destino = $pasaje->ciudad_destino;
                     }
                     $viajeFinal->eventos[$k]->viatico = Viatico::where('id', '=', $evento->viatico_id)->first();
                 }
                 $viajeFinal->tipoComision = $viaje->tipoComision;
                 $viajeFinal->mecanismoOrigen = $viaje->mecanismoOrigen;
                 $viajeFinal->instGenera = $viaje->instGenera;
                 $viajeArray[] = $viajeFinal;
             }
         } else {
             $viajeArray = array();
         }
         $response = array('status' => 'success', 'servidor' => array('contact' => $contact, 'puesto' => $puesto, 'cargo' => $cargo, 'unidadAdministrativa' => $unidadAdministrativa, 'numberOfViajes' => $numberOfViajes, 'viajes' => $viajeArray));
     } else {
         $response = array('status' => 'fail', 'message' => 'Tu perfil como servidor aún no ha sido de alta.');
     }
     if ($json == true) {
         //regresamos respuesta en json
         return Response::json($response);
     } else {
         return $response;
     }
 }
Exemplo n.º 9
0
 public function getCity($id = NULL)
 {
     if (Request::ajax()) {
         $req = Request::all();
         $data = City::where('id_province', '=', $req['provinsi'])->get();
         $option = '';
         foreach ($data as $row) {
             $option = $option . '<option value="' . $row->id . '">' . $row->name . '</option>';
         }
         print_r($option);
     }
 }
Exemplo n.º 10
0
 /**
  * Show the form for editing the specified outlet.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($outlet)
 {
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
     $retailers = Retailer::owner()->lists('name', 'id');
     $addresses = Address::select(array('addresses.id', 'addresses.address'))->lists('address', 'id');
     $images = Picture::getByRefId($outlet->id, 'outlet');
     if ($outlet->status == 'active') {
         $title = Lang::get('site/outlets/title.outlet_update');
     } else {
         $title = Lang::get('site/outlets/title.create_a_new_outlet');
     }
     return View::make('site.outlets.edit', compact('countries', 'cities', 'outlet', 'title', 'retailers', 'addresses'))->nest('imageForm', 'site.partials.image.create', ['refId' => $outlet->id, 'type' => 'outlet', 'images' => $images]);
 }
Exemplo n.º 11
0
 /**
  * Update the specified outlet in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $retailer = Retailer::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Retailer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $retailer->update($data);
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', $retailer->country_id)->lists('city', 'id');
     $addresses = Address::where('city_id', $retailer->city_id)->lists('address', 'id');
     $cats = BusinessCategory::lists('name', 'id');
     return Redirect::to('admin/retailers/' . $retailer->id . '/edit')->with('success', 'Update retailer');
 }
Exemplo n.º 12
0
 public function loadCities($state_id)
 {
     $cities = City::where('state_id', '=', $state_id)->get();
     return $cities->toJson;
 }
Exemplo n.º 13
0
 /**
  * Get edit user's profile
  * @param $username
  * @return mixed
  */
 public function getEdit($username)
 {
     $userModel = new User();
     $user = $userModel->getUserByUsername($username);
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
     // Check if the user exists
     if (is_null($user)) {
         return App::abort(404);
     }
     $images = Picture::getByRefId($user->id, 'user');
     return View::make('site/user/edit', compact('user', 'countries', 'cities'))->nest('imageForm', 'site.partials.image.create', ['refId' => $user->id, 'type' => 'user', 'images' => $images]);
 }
Exemplo n.º 14
0
 public function excursionAddToCart()
 {
     $excursion = Input::get('excursion');
     $excursion_city = Input::get('excursion_city');
     $excursion_transport = Input::get('excursion_transport');
     $excursion_pax = Input::get('excursion_pax');
     $excursion_rate = Input::get('excursion_rate');
     $excursion_total = Input::get('excursion_total');
     $excursion_date = date("Y-m-d", strtotime(Input::get('excursion_date')));
     $city_id = City::where('city', $excursion_city)->first()->id;
     $transport_type = Input::get('excursion_transport_type');
     $excursion_cart_key = $excursion_date . '_' . $excursion . '_' . $city_id . '_' . $excursion_transport;
     $excursion_details = array('excursion' => $excursion, 'excursion_city' => $excursion_city, 'excursion_transport' => $excursion_transport, 'transport_type' => $excursion_transport, 'city_id' => $city_id, 'excursion_pax' => $excursion_pax, 'excursion_rate' => $excursion_rate, 'excursion_total' => $excursion_total, 'excursion_date' => $excursion_date, 'excursion_cart_key' => $excursion_cart_key, 'excursion_transport_type' => $transport_type);
     if (Session::has('excursion_cart_details')) {
         $data = Session::get('excursion_cart_details');
         $data[$excursion_cart_key] = $excursion_details;
     } else {
         $data = [];
         $data[$excursion_cart_key] = $excursion_details;
     }
     //$data['total_cost'] = $total_cost;
     Session::put('excursion_cart_details', $data);
     return Response::json(Session::get('excursion_cart_details'));
 }
Exemplo n.º 15
0
 public function delete_location()
 {
     $id = Request::segment(4);
     $city = City::find($id);
     City::where('id', $id)->delete();
     StoreLocation::where('zipcode', $city->zipcode)->delete();
     $message = "Successfully deleted the city";
     $type = "success";
     return Redirect::to('/admin/locations')->with('type', $type)->with('message', $message);
 }
Exemplo n.º 16
0
 public function test2()
 {
     $error = "";
     $regs = DB::table('registration')->get();
     foreach ($regs as $reg) {
         $user = new User();
         $user->name1 = strtoupper($reg->name1);
         $user->name2 = strtoupper($reg->name2);
         $user->email1 = $reg->email1;
         $user->email2 = $reg->email2;
         $user->contact1 = $reg->contact1;
         $user->contact2 = $reg->contact2;
         $user->squad = $reg->squad;
         $user->language = $reg->language;
         $school = strtoupper($reg->school);
         $city_name = ucwords(strtolower($reg->city));
         if (School::where('name', $school)->count() && City::where('name', $city_name)->count()) {
             $cityid = City::where('name', $city_name)->first();
             $school_name = School::where('name', $school)->where('city_id', $cityid->id)->first();
             $user->school_id = $school_name->id;
             $user->city_id = $cityid->id;
             $user->centre_city = $cityid->id * 10;
             $roll = "";
             if ($reg->squad === 'JUNIOR') {
                 $roll = "J";
             } else {
                 $roll = "H";
             }
             if ($reg->language === 'en') {
                 $roll .= "E";
             } else {
                 $roll .= "H";
             }
             $roll .= strval($cityid->code) . '0';
             $lastroll = User::withTrashed()->where('roll', 'LIKE', "%{$roll}%")->count();
             $roll .= str_pad(strval($lastroll + 1), 4, "0", STR_PAD_LEFT);
             $user->roll = $roll;
             $user->year = 2015;
             $user->paid = true;
             $user->comments = $reg->comments;
             $user->save();
         } else {
             if (School::where('name', $school)->count()) {
                 $error .= $city_name . '<br>';
             } elseif (City::where('name', $city_name)->count()) {
                 $error .= $school . '<br>';
             } else {
                 $error .= $school . '   ' . $city_name;
             }
         }
     }
     //        Auth::logout();
     return View::make('layouts.test3')->with('error', $error);
 }
 public function postJson($json = true, $viaje_id = null)
 {
     $viaje_id = $viaje_id == null && null != Request::get('viaje_id') ? Request::get('viaje_id') : $viaje_id;
     if (Request::isMethod('post')) {
         if (null !== Request::get('servidor_id') && Request::get('servidor_id') > 0) {
             $viajeModel = Viaje::whereHas('servidor', function ($q) {
                 $q->where('id', '=', Request::get('servidor_id'));
             })->get();
         } else {
             if (Request::get('servidores') != null && sizeof(Request::get('servidores')) > 0) {
                 $viajeModel = Viaje::whereIn('servidor_id', Request::get('servidores'))->get();
             } else {
                 if (Request::get('tema_id') != null && Request::get('tema_id') > 0) {
                     $viajeModel = Viaje::where('tema_id', '=', Request::get('tema_id'))->get();
                 } else {
                     $viajeModel = Viaje::all();
                 }
             }
         }
     } else {
         if (null !== $viaje_id || null != Request::get('viaje_id')) {
             $viajeModel = Viaje::where('id', '=', $viaje_id)->get();
         } else {
             $viajeModel = Viaje::all();
         }
     }
     $viajeArray = array();
     //            var_dump($viajeModel);die();
     foreach ($viajeModel as $viaje) {
         //
         $viajeFinal = $viaje;
         $servidor = new ServidorApiController();
         if ($viaje->servidor_id != null && $viaje->servidor_id > 0) {
             $viajeFinal->servidor = $servidor->getServidorProfile(false, $viaje->servidor_id, false)["servidor"];
         }
         //$viajeFinal->servidor->unidad_administrativa = UnidadAdministrativa::where('id','=',$viaje->servidor->unidad_administrativa_id);
         $viajeFinal->tema = $viaje->tema;
         $viajeFinal->eventos = $viaje->eventos;
         foreach ($viajeFinal->eventos as $k => $evento) {
             $viajeFinal->eventos[$k]->pasajes = $evento->pasajes;
             foreach ($evento->pasajes as $l => $pasaje) {
                 $pasaje->ciudad_origen = City::where('id', '=', $pasaje->ciudad_origen_id)->first();
                 $pasaje->ciudad_destino = City::where('id', '=', $pasaje->ciudad_destino_id)->first();
                 $viajeFinal->eventos[$k]->pasajes[$l]->ciudad_origen = $pasaje->ciudad_origen;
                 $viajeFinal->eventos[$k]->pasajes[$l]->ciudad_destino = $pasaje->ciudad_destino;
                 $viajeFinal->eventos[$k]->pasajes[$l]->compania = $pasaje->compania;
             }
             $viajeFinal->eventos[$k]->viatico = Viatico::where('id', '=', $evento->viatico_id)->first();
             if ($evento->viatico_id > 0) {
                 $hospedajes = null;
                 $viatico = Viatico::where('id', '=', $evento->viatico_id)->first();
                 if (isset($viatico)) {
                     $hospedajes = $viatico->hospedajes;
                 }
                 if ($hospedajes != null) {
                     $viajeFinal->eventos[$k]->viatico->hospedajes = $hospedajes;
                 }
                 //                    var_dump($hospedajes);die();
             }
         }
         //$viajeFinal->eventos->ciudad = $viaje->eventos->ciudad();
         $viajeFinal->tipoComision = $viaje->tipoComision;
         $viajeFinal->mecanismoOrigen = $viaje->mecanismoOrigen;
         $viajeFinal->instGenera = $viaje->instGenera;
         $viajeArray[] = $viajeFinal;
     }
     if ($json == true) {
         return Response::json($viajeArray);
     } else {
         return $viajeArray;
     }
 }
Exemplo n.º 18
0
 public function filter(Request $request)
 {
     $posts = Post::with('author', 'comments.author', 'community')->where('sold', NULL)->whereBetween('price', array($request->to, $request->from))->where('community_id', $request->community)->paginate(12);
     $community = City::where('id', $request->city)->get();
     return view('community.home', ['posts' => $posts, 'community' => $community]);
 }
Exemplo n.º 19
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function tourDetail($country = '', $tour = '', $tour_type = '')
 {
     if (Session::has('st_date')) {
         $st_date = Session::get('st_date');
     } else {
         $st_date = date("Y/m/d");
     }
     //Session::flush();
     if (Session::has('ed_date')) {
         $ed_date = Session::get('ed_date');
     } else {
         $ed_date = date("Y/m/d", strtotime($st_date . ' + 2 days'));
     }
     $filter_tours = Tour::where('val', 1)->get();
     $filter_cities = City::where('val', 1)->get();
     if (!empty($country)) {
         $country = str_replace('-', ' ', $country);
         $get_country_id = DB::table('countries')->where('country', 'LIKE', $country)->first();
         $country_id = $get_country_id->id;
     }
     if (!empty($tour)) {
         $tour = str_replace('-', ' ', $tour);
         $get_tour_id = DB::table('tours')->where('tour_title', 'LIKE', $tour)->first();
         $tour_id = $get_tour_id->id;
     }
     if (!empty($tour_type)) {
         $tour_type = str_replace('-', ' ', $tour_type);
         $get_tour_type_id = DB::table('tour_types')->where('tour_type_title', 'LIKE', $tour_type)->first();
         $tour_type_id = $get_tour_type_id->id;
     }
     $path = array();
     $tour = Tour::where('id', $tour_id)->where('val', 1)->get();
     $tour_type = TourType::where('id', $tour_type_id)->where('val', 1)->first();
     //        dd(DB::getQueryLog());
     if (!$tour_type->count()) {
         return Redirect::to('/403');
     }
     return View::make('tour.tour_details')->with(array('tour' => $tour, 'tour_id' => $tour_id, 'tour_type_id' => $tour_type_id, 'path' => $path, 'tour_type' => $tour_type, 'st_date' => $st_date, 'ed_date' => $ed_date, 'filter_tours' => $filter_tours, 'filter_cities' => $filter_cities));
 }
 /**
  * Get site area for rendering area text.
  *
  * @return void
  */
 public function getSiteArea()
 {
     global $data;
     global $settings;
     $area = Route::input('area');
     $data['area'] = City::where('code', $area)->firstOrFail()->toArray();
 }
Exemplo n.º 21
0
    public function autoComplete()
    {
        if (isset($_POST['queryString'])) {
            $queryString = $_POST['queryString'];
            // Is the string length greater than 0?
            if (strlen($queryString) > 0) {
                $hotels = Hotel::where('name', 'LIKE', '%' . $queryString . '%')->select('name')->where('val', 1)->limit(4)->get();
                $cities = City::where('city', 'LIKE', '%' . $queryString . '%')->select('city')->where('val', 1)->limit(4)->get();
                //dd(DB::getQueryLog());
                if (!is_null($cities)) {
                    if ($cities) {
                        // While there are results loop through them - fetching an Object.
                        foreach ($cities as $city) {
                            $directory = 'a';
                            $images = glob($directory . "location.png");
                            $img_path = array_shift($images);
                            $img_name = basename($img_path);
                            echo '
                        <div class="auto_complete">
                            <a value="' . $city->city . '" category="city">

                             <span class="search_thumb">
                            <img class="search_thumb" src="/images/site/location.png" />
                             </span>

                            <span class="category">' . $city->city . '
                            </span>

                            </a>
                            </div>';
                        }
                    }
                }
                if (!is_null($hotels)) {
                    if ($hotels) {
                        // While there are results loop through them - fetching an Object.
                        foreach ($hotels as $hotel) {
                            $directory = public_path() . '/images/site/';
                            $images = glob($directory . "hotel.png");
                            $img_path = array_shift($images);
                            $img_name = basename($img_path);
                            echo '
                        <div class="auto_complete">
                            <a value="' . $hotel->name . '" category="hotel">

                             <span class="search_thumb">
                             <img class="search_thumb" src="/images/site/hotel.png" />
                             </span>

                            <span class="category">' . $hotel->name . '
                            </span>

                            </a>
                            </div>';
                        }
                    }
                }
            } else {
                echo 'Please Type Again To Start The Search';
            }
            // There is a queryString.
        } else {
            echo 'There should be no direct access to this script!';
        }
    }
Exemplo n.º 22
0
 public function centrechange()
 {
     $emails = '';
     foreach (City::where('online', 1)->get() as $city) {
         CityRep::where('city_id', $city->id)->delete();
         foreach (User::where('city_id', $city->id)->get() as $user) {
             $emails .= $user->email1 . ';' . $user->email2 . ';';
         }
     }
     return $emails;
 }
Exemplo n.º 23
0
*/
Route::get('/', 'WelcomeController@index');
Route::get('a_propos', 'WelcomeController@aboutUs');
Route::get('fonctionnement', 'WelcomeController@fonctionnement');
Route::get('contact', 'WelcomeController@contact');
Route::get('boutiques', 'WelcomeController@boutiques');
Route::get('boutique_annonces/{n}', 'WelcomeController@showBoutiquePosts');
Route::get('boutique/{n}', 'WelcomeController@showBoutique');
Route::get('offres', 'WelcomeController@offres');
Route::get('demandes', 'WelcomeController@demandes');
Route::get('annonces', 'WelcomeController@annonces');
Route::get('annonce/{n}', 'WelcomeController@showAnnonce');
Route::get('paid', 'UserController@paid');
Route::post('checkout', 'UserController@payment');
Route::get('user-posts/{n}', 'UserController@showBoutiquePosts');
Route::get('user-profil/{n}', 'UserController@showProfil');
Route::get('user-edit-profil/{n}', 'UserController@editProfil');
Route::get('creer_compte', 'WelcomeController@creerCompte');
Route::post('enregistrer_compte', 'WelcomeController@enregistrerCompte');
Route::get('depot-annonce', 'DepotAnnonceController@getForm');
Route::post('depot-annonce', 'DepotAnnonceController@postForm');
Route::post('/indexPostValidation', 'WelcomeController@indexPostForm');
Route::resource('user', 'UserController');
Route::resource('post', 'PostController');
Route::get('home', '\\Bestmomo\\Scafold\\Http\\Controllers\\HomeController@index');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::get('/ajax-subcat', function () {
    $province_id = Input::get('province_id');
    $cities = City::where('id', '=', $province_id)->get();
    return Response::json($cities);
});
 public function create()
 {
     // init
     $data = array();
     if (Session::has('update_id') and Auth::check()) {
         $updated = SocialTarget::updateUserid(Session::get('update_id'));
         if ($updated) {
             // show success alert
             $data['success'] = true;
             // unset session
             Session::forget('update_id');
         }
     } else {
         if (Session::has('success')) {
             $data['success'] = true;
         }
     }
     // get categories
     $data['categories'] = SocialTargetCategory::where('status', '=', 1)->get();
     // get all cities
     $data['cities'] = City::where('status', '=', 1)->orderBy('name', 'asc')->get();
     return View::make('bagikasih.social-target.create', $data);
 }
Exemplo n.º 25
0
 public function register()
 {
     if (Input::has('zipcode')) {
         $zipcode = Input::get('zipcode');
         $store = City::where('zipcode', $zipcode)->first();
         if ($store) {
             $message = "We’re available in " . $store->city;
         } else {
             $message = "We’ll be in " . $zipcode . " soon!";
         }
         return View::make('register')->with('zipcode', $zipcode)->with('message', $message);
     } else {
         return Redirect::to('/');
     }
 }
 public function edit_informacion()
 {
     $user_id = Auth::user()->id;
     $colonia = Session::get("colonia");
     $colony = Colony::findOrFail($colonia);
     $urbanism = Urbanism::where('colony_id', '=', $colony->id)->first();
     $urb_type = DB::table('urbanism_types')->where('id', $urbanism->urbanism_type_id)->first();
     $city = DB::table('cities')->where('id', $colony->location_id)->first();
     $state = DB::table('states')->where('id', $city->state_id)->first();
     $country = DB::table('countries')->where('id', $state->country_id)->first();
     $urbanism_types = UrbanismType::orderBy('id', 'ASC')->lists('type', 'id');
     $countries = Country::orderBy('id', 'ASC')->lists('name', 'id');
     $states = State::orderBy('id', 'ASC')->lists('name', 'id');
     $cities = City::where('state_id', '=', $state->id)->orderBy('id', 'ASC')->lists('name', 'id');
     $breadcrumbs = Neighbors::where('user_id', '=', $user_id)->first();
     $breadcrumbs_data = $breadcrumbs->name . " " . $breadcrumbs->last_name . " [ " . $urbanism->Colony->name . " ]";
     return View::make('dashboard.colonies.config.info', ['urbanism_types' => $urbanism_types, 'usuario' => $breadcrumbs_data, 'colony' => $colony, 'urbanism' => $urbanism, 'countries' => $countries, 'states' => $states, 'cities' => $cities, 'select' => [$urb_type->id => $urb_type->type], 'select_1' => [$country->id => $country->name], 'select_2' => [$state->id => $state->name], 'select_3' => [$city->id => $city->name]]);
 }
Exemplo n.º 27
0
 public static function getKeyValueData()
 {
     return array(null => 'All') + City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
 }
Exemplo n.º 28
0
 public static function getAll()
 {
     return City::where('status', 1)->get();
 }
 public function transportMapCreate()
 {
     $origin = Input::get('origin');
     $origin_longitude = City::where('id', $origin)->select('longitude')->first()->longitude;
     $origin_latitude = City::where('id', $origin)->select('latitude')->first()->latitude;
     if (Input::has('destination_1')) {
         $destination_1 = Input::get('destination_1');
         $destination_1_longitude = City::where('id', $destination_1)->select('longitude')->first()->longitude;
         $destination_1_latitude = City::where('id', $destination_1)->select('latitude')->first()->latitude;
     } else {
         $destination_1_longitude = '';
         $destination_1_latitude = '';
     }
     if (Input::has('destination_2')) {
         $destination_2 = Input::get('destination_2');
         $destination_2_longitude = City::where('id', $destination_2)->select('longitude')->first()->longitude;
         $destination_2_latitude = City::where('id', $destination_2)->select('latitude')->first()->latitude;
     } else {
         $destination_2_longitude = '';
         $destination_2_latitude = '';
     }
     if (Input::has('destination_3')) {
         $destination_3 = Input::get('destination_3');
         $destination_3_longitude = City::where('id', $destination_3)->select('longitude')->first()->longitude;
         $destination_3_latitude = City::where('id', $destination_3)->select('latitude')->first()->latitude;
     } else {
         $destination_3_longitude = '';
         $destination_3_latitude = '';
     }
     $lan_lot_arr = array('origin_longitude' => $origin_longitude, 'origin_latitude' => $origin_latitude, 'destination_1_longitude' => $destination_1_longitude, 'destination_1_latitude' => $destination_1_latitude, 'destination_2_longitude' => $destination_2_longitude, 'destination_2_latitude' => $destination_2_latitude, 'destination_3_longitude' => $destination_3_longitude, 'destination_3_latitude' => $destination_3_latitude);
     $lan_lot_arr_full = array_slice($lan_lot_arr, 0);
     return Response::json($lan_lot_arr_full);
 }
Exemplo n.º 30
0
 public function showCenterReport($city_id, $center_id)
 {
     $cities = City::where('id', '<=', '25')->orderby('name', 'ASC')->get();
     $centers = Center::where('city_id', '=', $city_id)->where('status', '=', 1)->orderby('name', 'ASC')->get();
     $tables = DB::table('Student')->join('propel_student_wingman as B', 'Student.id', '=', 'B.student_id')->join('User as C', 'C.id', '=', 'B.wingman_id')->join('Center as D', 'D.id', '=', 'Student.center_id')->join('City as E', 'E.id', '=', 'D.city_id');
     $child_data = $tables->select('Student.id as id', 'Student.name as name', 'C.name as wingman_name', 'D.id as center_id', 'D.name as center_name', 'E.name as city_name', 'E.id as city_id')->distinct()->where('E.id', '=', $city_id)->orderby('D.name', 'ASC')->where('D.id', '=', $center_id)->get();
     //$child_data = $tables->select('Student.name as name','C.name as wingman_name','D.id as center_id','D.name as center_name','E.name as city_name','E.id as city_id','F.id','F.id as journal_count','G.id as event_count')->distinct()->where('E.id','=',$city_id)->where('F.type','=','child_feedback')->orderby('D.name','ASC')->get(); //Test Query
     $child_data = (array) $child_data;
     $total = array();
     $total['wingman_session_count'] = 0;
     $total['asv_session_count'] = 0;
     $total['journal_count'] = 0;
     foreach ($child_data as $child) {
         $calendarEvent = CalendarEvent::where('student_id', '=', $child->id)->where('status', '<>', 'cancelled')->where('type', '=', 'wingman_time')->get();
         $child->wingman_session_count = count($calendarEvent);
         $total['wingman_session_count'] += $child->wingman_session_count;
         $calendarEvent = DB::table('propel_calendarEvents as A')->join('propel_wingmanTimes as B', 'A.id', '=', 'B.calendar_event_id')->where('A.student_id', '=', $child->id)->where('A.status', '=', 'attended')->get();
         $child->wingman_module_attended = count($calendarEvent);
         $calendarEvent = CalendarEvent::where('student_id', '=', $child->id)->where('status', '<>', 'cancelled')->where('type', '=', 'volunteer_time')->get();
         $child->asv_session_count = count($calendarEvent);
         $total['asv_session_count'] += $child->asv_session_count;
         $journalEntry = WingmanJournal::where('student_id', '=', $child->id)->where('type', '=', 'child_feedback')->get();
         $child->journal_count = count($journalEntry);
         $total['journal_count'] += $child->journal_count;
     }
     return View::make('reports.child-report.city-report')->with('child_data', $child_data)->with('cities', $cities)->with('city_id', $city_id)->with('centers', $centers)->with('center_id', '0')->with('total', $total);
 }