File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 3
3
namespace App \Livewire ;
4
4
5
5
use App \Enums \Subscription ;
6
- use Illuminate \ Support \ Facades \ Cache ;
6
+ use App \ Models \ User ;
7
7
use Laravel \Cashier \Cashier ;
8
8
use Livewire \Attributes \Layout ;
9
9
use Livewire \Attributes \Title ;
@@ -63,11 +63,21 @@ private function loadLicenseKey(): ?string
63
63
return null ;
64
64
}
65
65
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 ;
68
70
}
69
71
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 ;
71
81
}
72
82
73
83
private function loadSubscription (): ?Subscription
You can’t perform that action at this time.
0 commit comments