Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

franciscocaldeira's avatar

Retrieving Input From The Query String, and prevent SQL Injection

Hello to all Laravel devs. I have a $request->query('key'); how to prevent this from SQL injection like 1=1 or ;drop database -- etc..? I have string rule for my query params but that ins't enough. Any suggestions?

Thanks.

0 likes
1 reply
Snapey's avatar

use eloquent. It will use prepared statements.

Please or to participate in this conversation.