How to sanitize/escape raw SQL query in Laravel

$sample_query = 'SELECT id, name FROM users WHERE email = :email_placeholder';

$query = str_replace(':email_placeholder', \DB::connection()->getPdo()->quote('sample@email.com'), $query);

Leave a Reply