File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ public function permissions(): BelongsToMany
89
89
return $ relation ;
90
90
}
91
91
92
- return $ relation ->wherePivot (app (PermissionRegistrar::class)->teamsKey , getPermissionsTeamId ());
92
+ $ teamsKey = app (PermissionRegistrar::class)->teamsKey ;
93
+ $ relation ->withPivot ($ teamsKey );
94
+
95
+ return $ relation ->wherePivot ($ teamsKey , getPermissionsTeamId ());
93
96
}
94
97
95
98
/**
Original file line number Diff line number Diff line change @@ -58,10 +58,12 @@ public function roles(): BelongsToMany
58
58
if (! app (PermissionRegistrar::class)->teams ) {
59
59
return $ relation ;
60
60
}
61
+
62
+ $ teamsKey = app (PermissionRegistrar::class)->teamsKey ;
63
+ $ relation ->withPivot ($ teamsKey );
64
+ $ teamField = config ('permission.table_names.roles ' ).'. ' .$ teamsKey ;
61
65
62
- $ teamField = config ('permission.table_names.roles ' ).'. ' .app (PermissionRegistrar::class)->teamsKey ;
63
-
64
- return $ relation ->wherePivot (app (PermissionRegistrar::class)->teamsKey , getPermissionsTeamId ())
66
+ return $ relation ->wherePivot ($ teamsKey , getPermissionsTeamId ())
65
67
->where (fn ($ q ) => $ q ->whereNull ($ teamField )->orWhere ($ teamField , getPermissionsTeamId ()));
66
68
}
67
69
You can’t perform that action at this time.
0 commit comments