From 822ef4b168c840d6ea584109e944e60bef086361 Mon Sep 17 00:00:00 2001 From: Noxo <142592979+noxoua@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:24:40 +0300 Subject: [PATCH] Using a config instead of a model directly --- src/Models/Concerns/HasSubscriptions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Models/Concerns/HasSubscriptions.php b/src/Models/Concerns/HasSubscriptions.php index 14b3fe1..d754444 100644 --- a/src/Models/Concerns/HasSubscriptions.php +++ b/src/Models/Concerns/HasSubscriptions.php @@ -194,7 +194,8 @@ public function giveTicketFor($featureName, $expiration = null, ?float $charges new LogicException('The tickets are not enabled in the configs.'), ); - $feature = Feature::whereName($featureName)->firstOrFail(); + $featureModel = config('soulbscription.models.feature'); + $feature = $featureModel::whereName($featureName)->firstOrFail(); $featureTicket = $this->featureTickets() ->make([ @@ -386,7 +387,8 @@ protected function loadTicketFeatures(): Collection return $this->loadedTicketFeatures; } - return $this->loadedTicketFeatures = Feature::with([ + $featureModel = config('soulbscription.models.feature'); + return $this->loadedTicketFeatures = $featureModel::with([ 'tickets' => fn (HasMany $query) => $query->withoutExpired()->whereMorphedTo('subscriber', $this), ]) ->whereHas(