0

I'm somewhat new to Laravel and this is just a quick question, does Laravel use prepared statements by default so I don't have to worry about using them? Basically, does this statement (to use the example from the Laravel website):

DB::insert('insert into users (id, name) values (?, ?)', array(1, 'Dayle'));

use prepared statements automatically? Or if I want the security that comes with prepared statements will I have to do them manually? It seems like it does because of the question marks where where the values would be but I just wanted to double check before just making that assumption and making an unnecessary security mistake.

diodepain
  • 39
  • 1
  • 8

1 Answers1

4

Have a look at Connection.php.

Search for the insert method which eventually will leads you to:

$statement = $me->getPdo()->prepare($query);
SteD
  • 13,909
  • 12
  • 65
  • 76
  • Maybe you can help me. Look at this : https://stackoverflow.com/questions/51838922/how-can-i-convert-many-statement-mysql-to-laravel-eloquent – moses toh Aug 14 '18 at 10:55