{{-- In-app paywall โ a slide-up bottom sheet shown over a feature page when the current workspace's plan does NOT include that feature. Shows the actual plan CARDS that unlock it so the operator can pick + upgrade. Source of the required feature: 1. View::share('planPaywall', ...) set by EnforcePlanFeature on plan:-gated routes (calling / AI), OR 2. the config/plan_gates.php URL-path map. Platform admins, unlocked plans, and non-mapped pages render nothing. No inline JS โ links only; the slide-up is a CSS keyframe in wadesk.css. --}} @php $u = auth()->check() ? auth()->user() : null; $ws = $u?->currentWorkspace; $isAdmin = false; if ($u) { try { $isAdmin = $u->hasRole('Super Admin') || $u->hasRole('Admin'); } catch (\Throwable $e) { } if (!$isAdmin) { $isAdmin = in_array($u->role ?? null, ['admin', 'A', 'super-admin', 'platform-admin'], true); } } $shared = \Illuminate\Support\Facades\View::shared('planPaywall'); $feature = is_array($shared) ? $shared['feature'] ?? null : null; $label = is_array($shared) ? $shared['label'] ?? null : null; if (!$feature) { foreach ((array) config('plan_gates', []) as $pattern => $feat) { if (request()->is($pattern)) { $feature = $feat; break; } } } $show = false; $plans = collect(); if ($u && $ws && $feature && !$isAdmin) { if (!\App\Services\PlanLimitGuard::hasFeature($ws, $feature)) { $show = true; $label = $label ?: ucfirst(str_replace(['access_', '_'], ['', ' '], $feature)); try { if (\Illuminate\Support\Facades\Schema::hasColumn('packages', $feature)) { $plans = \App\Models\Package::where('status', 1) ->where($feature, 1) ->orderBy('sort_order') ->orderBy('plan_amount') ->get(); } } catch (\Throwable $e) { } } } $plansUrl = \Illuminate\Support\Facades\Route::has('account.plans') ? route('account.plans') : url('/account/plans'); @endphp @if ($show)
@endif