File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33namespace App \Livewire ;
44
55use App \Enums \Subscription ;
6- use Illuminate \ Support \ Facades \ Cache ;
6+ use App \ Models \ User ;
77use Laravel \Cashier \Cashier ;
88use Livewire \Attributes \Layout ;
99use Livewire \Attributes \Title ;
@@ -63,11 +63,21 @@ private function loadLicenseKey(): ?string
6363 return null ;
6464 }
6565
66- if ($ licenseKey = Cache::get ($ this ->email .'.license_key ' )) {
67- session ()->put ($ this ->sessionKey ('license_key ' ), $ licenseKey );
66+ $ user = User::where ('email ' , $ this ->email )->first ();
67+
68+ if (! $ user ) {
69+ return null ;
6870 }
6971
70- return $ licenseKey ;
72+ $ license = $ user ->licenses ()->latest ()->first ();
73+
74+ if (! $ license ) {
75+ return null ;
76+ }
77+
78+ session ()->put ($ this ->sessionKey ('license_key ' ), $ license ->key );
79+
80+ return $ license ->key ;
7181 }
7282
7383 private function loadSubscription (): ?Subscription
You can’t perform that action at this time.
0 commit comments