我在PHP Faker测试应用程序中使用Laravel 5.7生成了30条虚假帖子,到目前为止,所有数据都可以生成,我的问题是,我想给每个帖子提供一个真实的相对网址,而不是假网址。
public function run()
{
$faker = Faker::create();
foreach(range(1,30) as $index){
DB::table('posts')->insert([
'user_id' => $faker->numberBetween($min = 1, $max = 30),
'title' => $faker->sentence,
'post_image' => $faker->imageUrl($width = 640, $height = 480,
'cats', true, 'Faker'),
'url', $faker->url( ????? ),
'content' => $faker->realText(150),
'created_at' => $faker->dateTimeBetween($startDate = '-10 years', $endDate = 'now', $timezone = null, $format = 'Y-m-d H:i:s', $max = 'now'),
]);
}
}