I want to setup a test data through Faker using a factory. but when I try to add images to the model
"images" => $faker->image('public/storage/images',400,300, null, false),
it returns an error
Cannot write to directory "public/storage/images"
even thought I ran
php artisan storage:link
How to solve this problem? I am using Ubuntu btw.
You are attempting to write to the directory public/storage/images, this is relative to the root of your server as in /public/storage/images.
You have to write to the storage directory of your app, such as:
$faker->image(storage_path('images'),400,300, null, false)
Or directly to the public folder as well:
$faker->image(public_path('images'),400,300, null, false)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With