File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ protected function getAccessiblePlugins(User $user): array
151151 }
152152 }
153153
154- // Ultra team members get access to all official paid plugins
154+ // Team members get access to official plugins and owner's purchased plugins
155155 if ($ user ->isUltraTeamMember ()) {
156156 $ officialPlugins = Plugin::query ()
157157 ->where ('type ' , \App \Enums \PluginType::Paid)
@@ -169,6 +169,27 @@ protected function getAccessiblePlugins(User $user): array
169169 }
170170 }
171171
172+ $ teamOwner = $ user ->getTeamOwner ();
173+
174+ if ($ teamOwner ) {
175+ $ teamPlugins = $ teamOwner ->pluginLicenses ()
176+ ->active ()
177+ ->with ('plugin:id,name ' )
178+ ->get ()
179+ ->pluck ('plugin ' )
180+ ->filter ()
181+ ->unique ('id ' );
182+
183+ foreach ($ teamPlugins as $ plugin ) {
184+ if (! collect ($ plugins )->contains ('name ' , $ plugin ->name )) {
185+ $ plugins [] = [
186+ 'name ' => $ plugin ->name ,
187+ 'access ' => 'team ' ,
188+ ];
189+ }
190+ }
191+ }
192+
172193 return $ plugins ;
173194 }
174195}
Original file line number Diff line number Diff line change @@ -127,14 +127,6 @@ public function developerAccount(): HasOne
127127 return $ this ->hasOne (DeveloperAccount::class);
128128 }
129129
130- /**
131- * @return HasOne<Team>
132- */
133- public function ownedTeam (): HasOne
134- {
135- return $ this ->hasOne (Team::class);
136- }
137-
138130 /**
139131 * @return HasMany<TeamUser>
140132 */
You can’t perform that action at this time.
0 commit comments