hi, i need to do this query:
SELECT avg(vote) FROM (SELECT max(timestamp), vote FROM votes_table WHERE object = $id GROUP BY user)
i don't want to do this DB::raw(SELECT max(timestamp), vote FROM votes_table WHERE object = $id GROUP BY user) because it can be make some SQLInjection problem someone has a solution?
It can only be injected if you allow $id to be set from outside the environment, and if that is the case just sanitize the input.
I wouldn't worry about any injections with that query.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community