/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (Request::has('lat') && Request::has('lng')) { Location::setCurrent(Request::get('lat'), Request::get('lng')); Session::put('geoIP', true); } if (Session::get('geoIP')) { View::share(['haveGeoIp' => true]); } else { View::share(['haveGeoIp' => false]); } $location = Location::current(); if ($location->parent != null) { $location = $location->parent; } View::share(['user' => Auth::user(), 'location' => $location, 'locations' => Location::all(), 'homepage' => HomePage::where('location_id', '=', $location->id)->first(), 'colors' => $location->colors(), 'profiles' => $location->profiles()]); return $next($request); }