TijmenWierenga / LaravelChargebee

A Laravel package which provides an easy way to handle billing and subscriptions.
MIT License
42 stars 22 forks source link

subscribed() #8

Open jmshofstall opened 6 years ago

jmshofstall commented 6 years ago

How do we check if the user has a subscription to plan 'x' or if the user is subscribed to any plan? I looked through the source and didn't see anything on it.

afrazahmmad commented 4 years ago

Add a relationship in User.php that query subscriptions table to find subscription with given plan id.

public function subscribed($planId){ return $this->subscriptions()->wherePlanId($planId)->first(); }