Auto Complete City Google Map API In Laravel

Auto Complete City Google Map API In Laravel

In this post we will give you information about Auto Complete City Google Map API In Laravel. Hear we will give you detail about Auto Complete City Google Map API In LaravelAnd how to use it also give you demo for it if it is necessary.

Hello, everyone in this tutorials we are share with you how to use google map’s autocompleted fill city API in youe laravel application in your form. this is very easy and many time require in any application in register form and any other form.


In this tutorials we are show you country base autocomplete city in text box.


We are create one simple example for autocomplete city API usign google map’s API. simple follow this step for integrate in your laravel application


Step : 1 Create Route


First we are create one route in your routes/web.php file




Route::get('auto-complete-city', 'AutoCompleteController@index')->name('auto-complete-city');



Step : 2 Create controller


Now we are create AutoCompleteController in app/Http/Controllers folder




namespace AppHttpControllers;

use AppHttpRequests;
use IlluminateHttpRequest;
use DB;
use PDF;

class AutoCompleteController extends Controller
{
    /**
     * Show the application dashboard.
     *
     * @return IlluminateHttpResponse
     */
    public function index(Request $request)
    {        
        return view('auto-complete-city');
    }
}



Step : 3 Create Blade File



Into the last we are create one blade file and simple put into it following .




<!DOCTYPE html>
<html>
<head>
	<title>User list - PDF</title>
	<link rel="stylesheet" type="text/css" href="#">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
	<script src="https://maps.googleapis.com/maps/apihttps://onlinecode.org/js?key=GOOGLE_MAP_API_KEY&libraries=placesĀ®ion=in"></script>
</head>
<body>
<div >
	<form>
		<div >
            <label>City<star>*</star></label>
            <input type="text" name="city" placeholder="City"  value="{{ old('city') }}" id="city">
        </div>
	</form>
	<script type="text/javascript">
		function initialize() {
		    var options = {
		        types: ['(cities)'],
		        componentRestrictions: {country: "in"}
		    };
		    var input = document.getElementById('city');
		    var autocomplete = new google.maps.places.Autocomplete(input, options);
		}
		google.maps.event.addDomListener(window, 'load', initialize);
	</script>
</div>
</body>
</html>



See also 

How to revoke 'git add' before 'git commit' ?

In this post we will give you information about How to revoke 'git add' before 'git commit' ?. Hear we will give you detail about How to revoke 'git add' before 'git commit' ?And how to use it also give you demo for it if it is necessary.



Sometimes you need to undo your git file before you git comment command. Because you made a some misteck or wrong code and you did git add using "git add ." command then you think how to undo your code before git commit command. But you can do that using git reset command, if you need to undo all file Or you may need to undo just one then you can do using git reset command, you can see bellow command.

Example:

 // For Spesific file

git reset

// For all files

git reset

Hope this code and post will helped you for implement How to revoke 'git add' before 'git commit' ?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Now we are ready to run our example so run bellow command ro quick run:




php artisan serve



Now you can open bellow URL on your browser:




http://localhost:8000/auto-complete-city



If you face any problem then please write a comment or give some suggestions for improvement. Thanks…

Hope this and post will helped you for implement Auto Complete City Google Map API In Laravel. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  70  =  76

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US