dynamic; return $dynamic->participants()->where('user_id', $user->id)->exists(); } /** * Determine whether the user can update the mutation. */ public function update(User $user, Mutation $mutation): bool { $dynamic = $mutation->ledger->dynamic; $isOwner = $dynamic->participants()->where('user_id', $user->id)->where('role', 'owner')->exists(); return $isOwner && $mutation->status === 'pending'; } /** * Determine whether the user can void the mutation. */ public function void(User $user, Mutation $mutation): bool { $dynamic = $mutation->ledger->dynamic; $isOwner = $dynamic->participants()->where('user_id', $user->id)->where('role', 'owner')->exists(); return $isOwner && $mutation->status !== 'voided'; } }