app/Http/Controllers/WelcomeController.php
/**
	 * Show the application welcome screen to the user.
	 *
	 * @return Response
	 */
Show the application welcome screen to the user.
@return Response
Show the application welcome screen to the user . @return Response
public function index()
	{
		$instagram = new \MetzWeb\Instagram\Instagram(array(
			'apiKey'      => 'a07741f8d6ee40048d9f2505d58118e1',
			'apiSecret'   => 'b45edac40831451fbd5fe525ad865c49',
			'apiCallback' => 'http://localhost:8000/'
		));
		if (!Session::has('access_token')){
			$code = $_GET['code'];
			$data = $instagram->getOAuthToken($code);
			if (isset($data->access_token)) {
				$instagram->setAccessToken($data);
				Session::put('access_token',$data->access_token);
			} else {
				echo "<a href='{$instagram->getLoginUrl()}'>Login with Instagram</a>";
			}
		}
		$searchmedia = $instagram->searchMedia(52.9521724, -1.143788719, 2000, strtotime("-1 week"));
		return view('perve', ['media' => $searchmedia]);
	}
public function index ( ) { $ instagram = new \ MetzWeb \ Instagram \ Instagram ( array ( 'apiKey' => 'a07741f8d6ee40048d9f2505d58118e1' , 'apiSecret' => 'b45edac40831451fbd5fe525ad865c49' , 'apiCallback' => 'http://localhost:8000/' ) ) ; if ( ! Session :: has ( 'access_token' ) ) { $ code = $ _GET [ 'code' ] ; $ data = $ instagram -> getOAuthToken ( $ code ) ; if ( isset ( $ data -> access_token ) ) { $ instagram -> setAccessToken ( $ data ) ; Session :: put ( 'access_token' , $ data -> access_token ) ; } else { echo " <a href=' { $ instagram -> getLoginUrl ( ) } '>Login with Instagram</a> " ; } } $ searchmedia = $ instagram -> searchMedia ( 52.9521724 , - 1.143788719 , 2000 , strtotime ( " -1 week " ) ) ; return view ( 'perve' , [ 'media' => $ searchmedia ] ) ; }
Show the application welcome screen to the user.
Show the application welcome screen to the user .