I have a problem with the foreign key to generate random data, I already overflowed the documentation of the Seeders but there is no relationship with the foreign keys, I hope your help, thanks.
public function getDependencies(){
return UsersTable::class;
}
public function run()
{
$faker = Faker\Factory::create();
$data = [];
$foreignKeys = $this->getDependencies()->fetchAll(['id']);
for ($i=0; $i < 200 ; $i++) {
$data[] = [
'title' => $faker->name(),
'description' => $faker->text(),
'url' => $faker->url(),
'created' => date("Y-m-d H:i:s"),
'modified' => date("Y-m-d H:i:s"),
'user_id' => $foreignKeys[array_rand($foreignKeys)]
];
}
$table = $this->table('bookmarks');
$table->insert($data)->save();
}