Check if the user has a feature

Laraship QuestionsCategory: TechnicalCheck if the user has a feature
harter patrick asked 4 years ago
How can I check if a user has a feature after subscribing, for example, I have a feature called Webmail Support, how do I know if a user plan has Webmail Support feature to decide what to do?
laraship Staff replied 4 years ago

Hello Harter,
Are you referring to coding wise ?

harter patrick replied 4 years ago

Hello,

Thank you for replying.

I don’t know what you mean by code wisdom.

I purchased Laraship Subscriptions and it has plans and each plan has features. Suppose a user subscribed to a plan that has listings feature. Before showing the listings page on the website, how do I know if a user has the listings feature.

I couldn’t find anything about this in the documentation.

Is there such a thing as the examples below?

// Use the plan instance to get feature’s value
$amountOfPictures = $plan->getFeatureByName(‘pictures_per_listing’)->value;

$user->subscription(‘main’)->canUseFeature(‘listings’);

Thank you!

harter patrick replied 4 years ago

Can I get some help please?