PHP code example of lquintana / google-places-popular-times

1. Go to this page and download the library: Download lquintana/google-places-popular-times library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lquintana / google-places-popular-times example snippets

 bash
php artisan vendor:publish --tag="googlepopulartimes"
 php


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use LQuintana\GooglePopularTime\Facades\GooglePopularTime;

class PlaceController extends Controller
{
    /**
     * @params $request
     * Return list of places with its popular time.
     */
    public function index(Request $request)
    {
        $data = $request->all();
        $places = GooglePopularTime::getNearbyPlacesWithPopularTimes($data);
        return response()->json($places, 200);
    }
}

 php


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use LQuintana\GooglePopularTime\Facades\GooglePopularTime;

class PlaceController extends Controller
{
    /**
     * @params $request
     * Return place with its popular time.
     */
    public function show(Request $request, $place)
    {
        $placeDetails = GooglePopularTime::getPlaceDetailsWithPopularTimes($place);
        return response()->json($placeDetails, 200);
    }
}

 php


GooglePopularTime::getNearbyPlaces($data);

 php


GooglePopularTime::getPlaceDetails($placeId);