Deploy Ladill Queue / deploy (push) Successful in 42s
Organizations can upgrade from wallet with plan expiry enforcement and nightly qms:pro-renew charges. Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
1.5 KiB
PHP
54 lines
1.5 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();
|
|
$isPro = false;
|
|
|
|
if ($user) {
|
|
$organization = app(OrganizationResolver::class)->resolveForUser($user);
|
|
if ($organization) {
|
|
$isPro = app(PlanService::class)->isPro($organization);
|
|
}
|
|
}
|
|
|
|
$view->with('isPro', $isPro);
|
|
});
|
|
|
|
View::composer(['partials.topbar'], function ($view) {
|
|
$view->with(\App\Support\MobileTopbar::resolve());
|
|
});
|
|
}
|
|
}
|