I need to create a seeder that will import data from a csv file. The csv file contains the path to an image file that needs to be attached to the model.
In the documentation we find:
You may also pass a string to the data attribute that contains an absolute path to a local file.
$model->avatar = '/path/to/somefile.jpg';
Unfortunately I might be missing something. This is the relevant code:
Model
public $attachOne = [
'image' => 'System\Models\File'
];
Seeder
$product->image = '/path/image.png';
$product->save();
Error
The error is that the file is not being created. On top of that, no errors are shown in the migration log.
PS: When saving from an file upload field, everything works as expected.