route('token') ?? $request->header('X-Device-Token') ?? $request->ip(); return Limit::perMinute(30)->by((string) $key); }); RateLimiter::for('qr-scan', fn (Request $request) => Limit::perMinute(20)->by($request->ip())); RateLimiter::for('device-heartbeat', function (Request $request) { return Limit::perMinute(60)->by((string) ($request->header('X-Device-Token') ?? $request->ip())); }); View::composer('partials.sidebar', function ($view) { /** @var User|null $user */ $user = auth()->user(); $planKey = 'free'; $isPro = false; $isEnterprise = false; $hasPaidPlan = false; if ($user) { $organization = app(OrganizationResolver::class)->resolveForUser($user); if ($organization) { $plans = app(PlanService::class); $planKey = $plans->planKey($organization); $isPro = $planKey === 'pro'; $isEnterprise = $planKey === 'enterprise'; $hasPaidPlan = $plans->hasPaidPlan($organization); } } $view->with([ 'planKey' => $planKey, 'isPro' => $isPro, 'isEnterprise' => $isEnterprise, 'hasPaidPlan' => $hasPaidPlan, ]); }); View::composer(['partials.topbar'], function ($view) { $view->with(\App\Support\MobileTopbar::resolve()); }); } }