Attempted to lazy load [owner] on model [Laravel\\Cashier\\Subscription] but lazy loading is disabled.
I used Model::preventLazyLoading() in my laravel app. I get this error when I request to cancel a subscription.
My code: $result = $user->subscription($subscription->name)->cancel();
@sayedsahin And? You’ve disabled lazy-loading, but that code tries to lazy-load a relation, hence the error. The feature is doing literally what it’s meant to do. It’s like locking your door and then complaining you’re locked out of your house.
@sayedsahin Yeah, your code work perfectly because you have one record in DB for that subscription. The problem with this is when in DB are multiple records and need to load.
In my case, I have a subscription that was canceled, and then the user subscribes again, and for me the problem was when the second subscription became past_due and the user had to confirm the payment. And when I was calling $subscription->latestPayment(), I had to load the relationships first.