refactor(policy): optimize team membership checks in S3StoragePolicy
This commit is contained in:
parent
e3e80744a7
commit
ea115e6d31
1 changed files with 2 additions and 2 deletions
|
|
@ -21,7 +21,7 @@ public function viewAny(User $user): bool
|
||||||
*/
|
*/
|
||||||
public function view(User $user, S3Storage $storage): bool
|
public function view(User $user, S3Storage $storage): bool
|
||||||
{
|
{
|
||||||
return $user->teams()->get()->firstWhere('id', $storage->team_id) !== null;
|
return $user->teams()->where('id', $storage->team_id)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,7 +45,7 @@ public function update(User $user, Server $server): bool
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, S3Storage $storage): bool
|
public function delete(User $user, S3Storage $storage): bool
|
||||||
{
|
{
|
||||||
return $user->teams()->get()->firstWhere('id', $storage->team_id) !== null;
|
return $user->teams()->where('id', $storage->team_id)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue