Problem when creating image with Faker

0

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

  • chmod -R 775 storage (probe with 777 too)
  • chown -R juan: www-data storage
  • 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)

        
    asked by Juan Pablo B 02.01.2019 в 12:18
    source

    0 answers