Created
April 27, 2022 08:51
-
-
Save tahashieenavaz/20d3e8a28b2267312091fd6d47b82132 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function insertGetIds(string $table, array $rowsToInsert) { | |
$ids = []; | |
foreach($rowsToInsert as $row) { | |
array_push($ids, \Illuminate\Support\Facades\DB::table($table)->insertGetId($row)); | |
} | |
return $ids; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment