Files
ladill-queue/app/Providers/AppServiceProvider.php
isaaccladandCursor 165c7238fe
Deploy Ladill Queue / deploy (push) Successful in 1m32s
Add Queue Enterprise billing and visible upgrade CTAs for all roles.
Enterprise charges per active branch (GHS 299+) with wallet subscribe/renew; sidebar and dashboard upsell no longer gated behind settings.view.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 01:23:36 +00:00

66 lines
2.0 KiB
PHP

<?php
namespace App\Providers;
use App\Events\ServiceEventOccurred;
use App\Listeners\PlatformServiceEventListener;
use App\Models\User;
use App\Services\Qms\OrganizationResolver;
use App\Services\Qms\PlanService;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
Event::listen(ServiceEventOccurred::class, PlatformServiceEventListener::class);
RateLimiter::for('kiosk-device', function (Request $request) {
$key = $request->route('token') ?? $request->ip();
return Limit::perMinute(30)->by((string) $key);
});
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());
});
}
}