Laravel - Getting Started - Running An Insert Statement
To execute an insert
statement, you may use the insert
method on the DB
facade. Like select
, this method accepts the SQL query as its first argument and bindings as its second argument:
use Illuminate\Support\Facades\DB;
DB::insert('insert into users (id, name) values (?, ?)', [1, 'Marc']);