Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

insert multiple rows laravel

$data = [
    ['user_id'=>'Coder 1', 'subject_id'=> 4096],
    ['user_id'=>'Coder 2', 'subject_id'=> 2048],
    //...
];

Model::insert($data); // Eloquent approach
DB::table('table')->insert($data); // Query Builder approach
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #insert #multiple #rows #laravel
ADD COMMENT
Topic
Name
2+6 =