0

I want to create some files for my seedfile using fzaninotto/faker.

file($sourceDir = '/tmp', $targetDir = '/tmp') // '/path/to/targetDir/13b73edae8443990be1aa8f1a483bc27.jpg'
file($sourceDir, $targetDir, false) // '13b73edae8443990be1aa8f1a483bc27.jpg'

My seedfile for the files looks like this:

$factory('App\File', [
    'order_id'         => 'factory:App\Order',
    'originalFilename' => $faker->file(public_path('files/uploads'), public_path('files/uploads/tmp'), false),
    'filename'         => $faker->randomNumber($nbDigits = NULL),
    'filepath'         => 'files/uploads'
]);

And I currently have a public folder structure that looks like this:

public
    -files
        -uploads
            -tmp <- Here are some dummy files of mine that can be used by fzaninotto fakers dummy creation class

How do I structure my seedfile correctly, to be able to generate some dummy files?

LoveAndHappiness
  • 9,735
  • 21
  • 72
  • 106

1 Answers1

0

Accidentally hat the source directory as target directory. This works now:

$factory('App\File', [
'order_id'         => 'factory:App\Order',
'originalFilename' => $faker->randomNumber($nbDigits = NULL),
'filename'         => $faker->file(public_path('files/uploads/tmp'), public_path('files/uploads'), false),
'filepath'         => 'files/uploads'
]);
LoveAndHappiness
  • 9,735
  • 21
  • 72
  • 106