mercredi 31 juillet 2019

How can I create a fake image file in laravel?

I am using laravel-medialibrary. I want to test store media. For that I write a function. The piece of that function is:

$file = UploadedFile::fake()->image($fileName);
$media = $this->owner->addMedia($file->path())
      ->usingName($fileName)
      ->usingFileName(str_uniq_file_name('png', str_slug($this->owner->name)))
      ->toMediaCollection($this->collection, $this->disk);

But this code has a several issue. The UploadedFile facade doesn't have much benefit method for me. How can I create a fake image by another way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire