Neel
Neel

Reputation: 9890

Get Stripe Customer Details in Laravel 5.3 with Cashier 7.0

In Laravel 5.1 with Cashier ~5.0, I used to get Stipe Customer details of that user like this:

$customer = $user->subscription()->getStripeCustomer();

After updating to Laravel 5.3 with Cashier ~7.0, I changed the above line in controller to this:

$customer = $user->subscription('main')->getStripeCustomer();

Since the update, I am now getting the error:

BadMethodCallException in Builder.php line 2440: 
Call to undefined method Illuminate\Database\Query\Builder::getStripeCustomer()

How can I get Stripe Customer Details in Laravel 5.3 with Cashier ~7.0?

Upvotes: 1

Views: 2233

Answers (1)

Damir Miladinov
Damir Miladinov

Reputation: 1382

You can get Stripe Customer with $user->asStripeCustomer()

Upvotes: 9

Related Questions