Create a factory in which I need to store an image.
The factory is:
$factory->define(\App\FinDra\Entities\Surface\SurfaceModel::class, function (Faker $faker) {
return [
'surface' => str_random(5),
'color' => '#6c757d',
'image_code' => $faker->image('public/storage/surfaces')
];
});
and when you run php artisan migrate: refresh --seed throws me the error:
Can not write to directory "public / storage / surfaces"
I gave the storage folder the permissions that I always give to all the projects and this works
and then I do:
php artisan storage: link
and with all this it tells me that you can not write to the directory that I want to save the image.
Update:
If I manually create the surfaces folder, it creates without problem the image with the faker image, if the folder does not exist it pulls error (previously created automatically)