@@ 57-70 (lines=14) @@ | ||
54 | ); |
|
55 | } |
|
56 | ||
57 | public function enableFor($featureName, FeaturableInterface $featurable) |
|
58 | { |
|
59 | /** @var Model $model */ |
|
60 | $model = Model::where('name', '=', $featureName)->first(); |
|
61 | if (!$model) { |
|
62 | throw new FeatureException('Unable to find the feature.'); |
|
63 | } |
|
64 | ||
65 | if ((bool) $model->is_enabled === true || $featurable->hasFeature($featureName) === true) { |
|
66 | return; |
|
67 | } |
|
68 | ||
69 | $featurable->features()->attach($model->id); |
|
70 | } |
|
71 | ||
72 | public function disableFor($featureName, FeaturableInterface $featurable) |
|
73 | { |
|
@@ 72-85 (lines=14) @@ | ||
69 | $featurable->features()->attach($model->id); |
|
70 | } |
|
71 | ||
72 | public function disableFor($featureName, FeaturableInterface $featurable) |
|
73 | { |
|
74 | /** @var Model $model */ |
|
75 | $model = Model::where('name', '=', $featureName)->first(); |
|
76 | if (!$model) { |
|
77 | throw new FeatureException('Unable to find the feature.'); |
|
78 | } |
|
79 | ||
80 | if ((bool) $model->is_enabled === true || $featurable->hasFeature($featureName) === false) { |
|
81 | return; |
|
82 | } |
|
83 | ||
84 | $featurable->features()->detach($model->id); |
|
85 | } |
|
86 | ||
87 | public function isEnabledFor($featureName, FeaturableInterface $featurable) |
|
88 | { |