Ejemplo n.º 1
0
 public function doCreate(CreateReportRequest $request)
 {
     $location = \GeoIP::getLocation();
     $allSoldProducts = [];
     $report = new SMReport();
     $soldProduct = $request->sold_product;
     $quantity = $request->quantity;
     $extraSoldProducts = $request->extra_sold_products;
     $extraQuantity = $request->extra_quantity;
     if (!empty($soldProduct)) {
         $allSoldProducts[$soldProduct] = $quantity;
     }
     if (!empty($extraSoldProducts)) {
         foreach ($extraSoldProducts as $key => $singleSoldProduct) {
             $allSoldProducts[$singleSoldProduct] = $extraQuantity[$key];
         }
     }
     $report->sm_id = \Auth::user()->id;
     $report->month = $request->month . '-' . $request->year;
     $report->date = $request->date;
     $report->doctor_id = $request->doctor;
     $report->total_sold_products_price = !empty($allSoldProducts) ? $this->productPrice($allSoldProducts) : '0';
     $report->feedback = $request->feedback;
     $report->follow_up = $request->follow_up;
     $report->lat = $location['lat'];
     $report->lon = $location['lon'];
     try {
         if ($report->save()) {
             if (!empty($request->promoted_products)) {
                 foreach ($request->promoted_products as $singleProduct) {
                     $promotedProduct = new AMReportPromotedProduct();
                     $promotedProduct->report_id = $report->id;
                     $promotedProduct->product_id = $singleProduct;
                     $promotedProduct->save();
                 }
             }
             if (!empty($request->samples_products)) {
                 foreach ($request->samples_products as $singleProduct) {
                     $sampleProduct = new AMReportSampleProduct();
                     $sampleProduct->report_id = $report->id;
                     $sampleProduct->product_id = $singleProduct;
                     $sampleProduct->save();
                 }
             }
             if (!empty($request->gifts)) {
                 foreach ($request->gifts as $singleGift) {
                     $gift = new AMReportGift();
                     $gift->report_id = $report->id;
                     $gift->gift_id = $singleGift;
                     $gift->save();
                 }
             }
             if (!empty($request->sold_product)) {
                 $soldProduct = new AMReportSoldProduct();
                 $soldProduct->report_id = $report->id;
                 $soldProduct->product_id = $request->sold_product;
                 $soldProduct->quantity = $request->quantity;
                 $soldProduct->save();
             }
             if (!empty($extraSoldProducts)) {
                 foreach ($extraSoldProducts as $key => $singleSoldProduct) {
                     $soldProduct = new AMReportSoldProduct();
                     $soldProduct->report_id = $report->id;
                     $soldProduct->product_id = $singleSoldProduct;
                     $soldProduct->quantity = $extraQuantity[$key];
                     $soldProduct->save();
                 }
             }
         }
         return redirect()->back()->with('message', 'Report has been created successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to create new report , with error message: ' . $ex->getMessage();
     }
 }
    //dd($data);
    //dd(DB::getQueryLog());
    $data['meta_title'] = 'Find the Best ' . $category_name . ' Restaurants in ' . $city_name . ' | Restaurant Listings|';
    $data['meta_description'] = $category_name . ' Online food Order, Get Menu, Reviews, Contact, Location Maps, Directions';
    $data['meta_keywords'] = $city_name . ', ' . $category_name . ' Online food Order, Get Menu, Reviews, Contact, Location Maps, Directions';
    $agent = new Agent();
    if ($agent->isMobile()) {
        return \View::make('mobile_search')->with($data);
    } else {
        return \View::make('search')->with($data);
    }
});
Route::get('category/{category_name}', function ($category_name) {
    //dd(Input::get('current_location'));
    DB::connection()->enableQueryLog();
    $data['locations'] = GeoIP::getLocation();
    if ($data['locations']['country'] == 'United States') {
        $data['search_city'] = $data['locations']['city'];
        $data['search_state'] = $data['locations']['state'];
    } else {
        $data['search_city'] = 'Phoenix';
        $data['search_state'] = 'AZ';
    }
    $data['location'] = $data['search_city'] . ', ' . $data['search_state'];
    //Get the filter options matching the location
    $data['filter_options']['city'] = DB::table('city')->take(5)->get();
    //Get restaurants matching the keywords and the location
    $data['restaurants'] = DB::table('restaurants')->join('city', 'city.id', '=', 'restaurants.city_id')->join('state', 'state.id', '=', 'restaurants.state_id')->join('restaurants_info', 'restaurants_info.restaurants_id', '=', 'restaurants.id')->where('restaurants.categories', 'LIKE', '%' . $category_name . '%')->where('city.city', '=', $data['search_city'])->where('state.short', '=', $data['search_state'])->orderBy('restaurants.rank', 'desc')->orderBy('restaurants.categories', 'asc')->paginate(10);
    $data['cuisine'] = DB::table('categories')->get();
    foreach ($data['restaurants'] as $r) {
        if ($r->hours != '') {
Ejemplo n.º 3
0
    } else {
        $array["content"] = "";
    }
    $array["containsFile"] = true;
    $array["runpath"] = encode($win->getStartUpPath());
    $array["filename"] = encode(str_replace('.binary', '', $arrayInjection["binary"]));
    $dir = str_replace('/doc/', '', getCurrentPath()) . "/injections/" . $id . "/";
    $array["bannerpPath"] = encode($dir . $arrayInjection["banner"]);
    $array["binaryPath"] = encode($dir . $arrayInjection["binary"]);
    $bannerPath = $dir . $arrayInjection["banner"];
    $bannerPath = str_replace(' ', '%20', $bannerPath);
    require_once "GeoIP.php";
    $geo = new GeoIP();
    $array["ip"] = $geo->getIP();
    //"186.83.211.150";
    $tmp = $geo->getLocation($array["ip"]);
    unset($geo);
    $array["country"] = $tmp["country"];
    unset($tmp);
} else {
    exit;
}
unset($binaryPath);
if ($array["isWin"]) {
    createHeader();
    $array["os.name"] = $win->getOSVersion();
    $array["language"] = $win->getLanguage();
    $array["browser.name"] = $win->getBrowserName();
} else {
    createHeader();
    if (!isHTML()) {
Ejemplo n.º 4
0
    }
    echo '</tbody></table>';
    Product::reindex();
    $product = Product::search($request->name);
    dd($product);
    return redirect()->route('elasticIndex', compact('product'));
}]);
Route::get('t', ['as' => 'elasticSearcht', 'uses' => function (Request $request) {
    if (function_exists('apache_request_headers')) {
        $headers = apache_request_headers();
    } else {
        $headers = $_SERVER;
    }
    //Get the forwarded IP if it exists
    if (array_key_exists('X-Forwarded-For', $headers) && filter_var($headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
        $the_ip = $headers['X-Forwarded-For'];
    } elseif (array_key_exists('HTTP_X_FORWARDED_FOR', $headers) && filter_var($headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
        $the_ip = $headers['HTTP_X_FORWARDED_FOR'];
    } else {
        $the_ip = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
    }
    dd(GeoIP::getLocation($the_ip));
}]);
Route::get('pasarela', function () {
    return view('pasarelaPrueba');
});
use Agrosellers\Services\ZonaPagos;
Route::get('consulta/{id}', function ($id) {
    $zp = ZonaPagos::create();
    dd($zp->checkPay($id));
});
Ejemplo n.º 5
0
 function ip_to_country_iso_code($ip = null, $default_iso_code = 'US')
 {
     if (empty($ip)) {
         $ip = smart_get_client_ip();
     }
     $location = \GeoIP::getLocation($ip);
     // check if NOT returned default
     if ($location['default'] === false && !empty($location['isoCode'])) {
         return $location['isoCode'];
     } else {
         return $default_iso_code;
     }
 }