Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

oliverbusk's avatar

Laravel Cashier - Eager loading owner not possible

In my Laravel's AppServiceProvider.php I have disabled lazy loading:

//AppServiceProvider.php
Model::preventLazyLoading(! $this->app->isProduction());

This will throw an exception every time a n+1 problem arises.

I am then using Laravel Cashier package to handle subscriptions in my application. I am using the official methods, and trying to get a subscription as a Stripe subscription:

$subscription = auth()->user()->subscription('monthly');
return $subscription->asStripeSubscription();

The above gives me this error:

Attempted to lazy load [owner] on model [Laravel\Cashier\Subscription] but lazy loading is disabled.

The asStripSubscription method looks like this, and is located in this file:

public function asStripeSubscription(array $expand = [])
{
    return $this->owner->stripe()->subscriptions->retrieve(
        $this->stripe_id, ['expand' => $expand]
    );
}
0 likes
0 replies

Please or to participate in this conversation.