Full source code for the seeder as follows:
<?php /** * Run the database seeds. * * @return void */ public function run() { $file = storage_path('contact.csv'); $etl = new \Marquine\Etl\Etl; $etl->extract('csv', $file); $etl->transform('trim', [ 'columns' => ['Name', 'Phone', 'Email'] ]); $etl->load('insert', 'contacts'); $etl->run(); }
#4 To start the seeding process, run the artisan command as follows:
php artisan db:seeder --class=ContactsTableSeeder
That’s all! Other than CSV, it also
Pages: 1 2