jeroenzwart / laravel-csv-seeder

Seed your database with Laravel using CSV files
Other
92 stars 30 forks source link

Getting Error in $this->outputParsed() #3

Closed dilipphp2 closed 5 years ago

dilipphp2 commented 5 years ago

When i try to seed i'm getting Symfony\Component\Debug\Exception\FatalThrowableError : Call to a member function line() on null

at /Applications/XAMPP/xamppfiles/htdocs/webspa/webapp-spa/vendor/jeroenzwart/laravel-csv-seeder/src/CsvSeeder.php:418 414| if( $level ) $message = '<'.$level.'>'.$message.'</'.$level.'>'; 415| if(empty($message)){ 416| dd('hi'); 417| }

418| dd($message,$this->command->line( 'CsvSeeder: '.$message )); 419| $this->command->line( 'CsvSeeder: '.$message ); 420| } 421| 422| }

Exception trace:

1 JeroenZwart\CsvSeeder\CsvSeeder::console("2 of 2 rows has been seeded in table "citizenship"") /Applications/XAMPP/xamppfiles/htdocs/webspa/webapp-spa/vendor/jeroenzwart/laravel-csv-seeder/src/CsvSeeder.php:388

2 JeroenZwart\CsvSeeder\CsvSeeder::outputParsed() /Applications/XAMPP/xamppfiles/htdocs/webspa/webapp-spa/vendor/jeroenzwart/laravel-csv-seeder/src/CsvSeeder.php:222

dilipphp2 commented 5 years ago

Also i am not able to override filepath because all variables and methods are private.

jeroenzwart commented 5 years ago

To set the csv file you have to use '$this->file'. Like this; $this->file = '/database/seeds/users.csv';

About the error, 'command' is a part of Laravel. Does the seeder of Laravel works? Because it using command. Which version of Laravel are you using?