Deploy Ladill Care / deploy (push) Successful in 29s
Free keeps core records, appointments, and basic workflows; Pro unlocks lab, pharmacy, billing, and Queue. Both paid tiers bill per branch with unlimited branches. Enterprise adds multi-dept workflows, analytics, AI-assisted healthcare integration, and priority support (not Afia).
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Events\ServiceEventOccurred;
|
|
use App\Listeners\PlatformServiceEventListener;
|
|
use App\Models\User;
|
|
use App\Services\Care\OrganizationResolver;
|
|
use App\Services\Care\PlanService;
|
|
use Illuminate\Support\Facades\Event;
|
|
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);
|
|
|
|
View::composer(['partials.sidebar', 'partials.topbar-desktop-widgets', 'partials.afia', 'components.app-layout'], 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());
|
|
});
|
|
|
|
View::composer(['partials.launcher', 'partials.topbar-desktop-widgets', 'components.app-layout'], function () {
|
|
$user = auth()->user();
|
|
if (! $user || session()->has(\App\Support\StaffUx::SESSION_KEY)) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
$access = app(\App\Services\Identity\IdentityTeamClient::class)
|
|
->appAccess($user->ownerRef());
|
|
\App\Support\StaffUx::remember($access);
|
|
} catch (\Throwable) {
|
|
// Leave fail-open defaults until Identity is available.
|
|
}
|
|
});
|
|
}
|
|
}
|