Fix possible sql injection in whereRaw query

This commit is contained in:
Bubka 2023-06-28 21:11:13 +02:00
parent d349f09ed4
commit 3d59b8b3c9

View File

@ -27,7 +27,7 @@ public function __construct()
public function passes($attribute, $value)
{
$user = DB::table('users')
->whereRaw('email = \'' . strtolower($value) . '\'' . ('sqlite' === config('database.default') ? ' COLLATE NOCASE' : ''))
->whereRaw('email = ?' . ('sqlite' === config('database.default') ? ' COLLATE NOCASE' : ''), [strtolower($value)])
->first();
return ! $user ? false : true;