gerardojbaez / laraplans

SaaS style recurring plans for Laravel.
http://laraplans.readthedocs.io
MIT License
180 stars 81 forks source link

$user->subscriptionUsage()->record('tempore'); fails #40

Open Georde opened 6 years ago

Georde commented 6 years ago

Invalid plan feature: tempore

tempore exist in database

Don't pass in Feature.php lines:

  1. if (!self::isValid($feature_code)) { 42 throw new InvalidPlanFeatureException($feature_code); 43 }

Laravel 5.6

gerardojbaez commented 6 years ago

Hi Georde,

Feature codes are stored in the config file config/laraplans.php under the config key features. You can view an example here. It should work correctly once you define the features in the config file.

I think the documentation is missing the features set up; will have to check.

Georde commented 6 years ago

But does not it make sense to have registered features in the config if I have dynamic features, I mean that all the features that I register in the database I have to have in this configuration file too?

gerardojbaez commented 6 years ago

You must configure your site features before using them. As I have mentioned in my previous comment, all features are defined in the config/laraplans.php file. Laraplans uses this file to validate the features passed and retrieve additional configuration (if needed).

Laraplans does not support dynamic features (i.e., loading them from the database). Any feature used by the site/package must be defined first in the config file.

Georde commented 6 years ago

ok thanks