Seeder
Insert multiple data against the database or seed data to the database with a selected table and set the number of iterations and column values using the seeder method.
// DB()->seeder($table, $length, $tableColumns = []);
// using the seeder
Route::get('/seed', function () {
$table = "customers";
$length = 1000;
$user_id = Auth::user('id');
$tableColumns = [
"name" => randChar(7),
"address" => randChar(),
"user_id" => $user_id
];
$response = DB()->seeder($table, $length, $tableColumns);
echo $response;
});
this will seed datas to the selected table which is customers
with the number of 1000
iterations and a column names with values to seed from the $tableColumns
.
Last updated