Module - How to seed data?
Created 6 years ago by marceaukaHi,
I'm building a module with a stream. There's no documentation about seeding. I've try this in my CategorySeeder.php
:
protected $data = [
[
'name' => 'Foo',
'slug' => 'foo'
],
// ...
];
public function run()
{
// "categories" is CategoryRepositoryInterface
$this->categories->truncate();
foreach ($this->data as $data) {
$this->categories->create($data);
}
}
But when I call artisan addon:reinstall vendor.type.name --seed
nothing happens.
Close! Make sure your addon seeder is calling the subsequent stream seeders like this: https://github.com/anomalylabs/pages-module/tree/2.3/src