工厂级
$factory->define(Product::class, function (Faker $faker) {
return [
'image' => url("/images/{$faker->image('public/storage/images',640,480, null, false)}")
];
});
在此命令之后
php artisan db:seed
用此字符串填充的数据库的图像列
http://localhost/images/a1af4cb757aef7f6b181dfb978228767.jpg"
当我在浏览器上搜索此URL时,出现“无法连接”错误
您需要先添加storage
链接,然后images/image_name
才能这样
http://localhost/storage/images/a1af4cb757aef7f6b181dfb978228767.jpg
确保您跑步
php artisan storage:link
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句