insert方法
$result = DB::table('user_role')->insert([
'role_name' => '测试', 'group_id_array' => 54,
'is_role' => 0, 'role_status' => 1, 'desc' => '测试'
]);
$data = [
['role_name' =>'测试','group_id_array' => 54,
'is_role' => 0,'role_status' => 1,'desc' => '测试'],
['role_name'=>'测试11','group_id_array' => 54,
'is_role' => 0,'role_status' => 1,'desc' => '测试11'],
['role_name' => '测试333','group_id_array' => 54,
'is_role' => 0,'role_status' => 1,'desc' => '测试333'],
];
$result = DB::table('user_role')->insert($data);
dd($result);
获取自增id
$id = DB::table('user_role')->insertGetId(
['role_name' => '测试','group_id_array' => 54,
'is_role' => 0,'role_status' => 1,'desc' => '测试']
);
dd($id);