where('id', $id)->first(); } public function getCaptchaTokens(CaptchaTokenDto $captchaTokenDto, array $with = [], ?int $userId = null): Search { $query = CaptchaToken::query() ->when($userId, function (Builder $query, int $userId) { $query->where('user_id', $userId); }) ->with($with); $query = $this->builderCommand->execute( query: $query, captchaTokenDto: $captchaTokenDto ); return $this->createSearchInstanceCommand->execute($query); } public function getCaptchaTokenByPublicToken(string $token): ?CaptchaToken { return CaptchaToken::query()->where('public_token', '=', $token)->first(); } }