Skip to content

Commit

Permalink
Fix isReadonlyUser
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragchhatrala committed Dec 19, 2024
1 parent c05f987 commit fcce45a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/app/Models/Workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ public function forms()
return $this->hasMany(Form::class);
}

public function isReadonlyUser(User $user)
public function isReadonlyUser(?User $user)
{
return $this->users()
return $user ? $this->users()
->wherePivot('user_id', $user->id)
->wherePivot('role', User::ROLE_READONLY)
->exists();
->exists() : false;
}
}

0 comments on commit fcce45a

Please sign in to comment.