route('organization'); if (! ($organization instanceof Organization)) { throw new \LogicException('The organization must be loaded before this middleware.'); } /** @var BillingContract $billing */ $billing = app(BillingContract::class); if ($billing->isBlocked($organization)) { throw new OrganizationHasNoSubscriptionButMultipleMembersException; } return $next($request); } }