ip(); $anonymousUser = User::where('ipAddress', $userIP)->get(); if (Auth::check() && Auth::user()->isBanned()) { View::share('isBanned', true); } elseif(!$anonymousUser->isEmpty() && User::find($anonymousUser->id)->isBanned()) { View::share('isBanned', true); } else { View::share('isBanned', false); } return $next($request); } }