I entered php artisan db:seed
but it skip seeding CountriesRetailerSeeder.
It seeds when I do it manually.
php artisan db:seed --class=CountriesRetailerSeeder
How will I be able to run it in php artisan db:seed
along with the other seeders ?
here's the code in my CountriesRetailerSeeder
public function run()
{
DB::table('country_retailer')->truncate();
$file = base_path().'/database/seeds/country_retailer_csv.csv';
$reader = Reader::createFromPath($file);
$data = array();
$count_elements = 0;
foreach($reader as $index => $row)
{
$data[$count_elements] = array('country'=>$row[0],'original_header'=>$row[1],'count'=>$row[2],
'channel'=>$row[3],'retailer'=>$row[4],
'website'=>$row[6],'contacts'=>$row[7],'notes'=>$row[8]);
$count_elements++;
}
$cr = new CountryRetailer;
$cr::insert($data);
}
Take not that all of those 2000 rows of data is from a csv file.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VO4gxR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire