Вы просите что-нибудь подобное?
$factory->define(File::class, function (Faker $faker) {
static $imageNumber = 0;
$imageNumber++;
$productId = 1;
$products = [
[
'file_refer_type' => 1,
'file_refer_id' => $productId,
'name' => 'Product Name ' . $productId,
'title' => 'Product Title ' . $productId,
'image_type' => 1,
'rank' => $imageNumber,
'file_type' => 1,
'file_size' => null,
'file_url' => config('app.url') . 'images/products/' . $productId . '_' . $imageNumber . '.jpg',
'thumbnail_url' => config('app.url') .'images/products/' . $productId . '_' . $imageNumber . '-thumb.jpg',
'file_name' => null,
'container' => null,
'folder' => null,
'file_extension' => null,
'file_width' => null,
'file_length' => null,
],
[
'file_refer_type' => 2,
'file_refer_id' => $productId,
'name' => 'Product Name ' . $productId,
'title' => 'Product Title ' . $productId,
'image_type' => 2,
'rank' => $imageNumber,
'file_type' => 2,
'file_size' => null,
'file_url' => config('app.url') . 'images/products/' . $productId . '_' . $imageNumber . '.jpg',
'thumbnail_url' => config('app.url') .'images/products/' . $productId . '_' . $imageNumber . '-thumb.jpg',
'file_name' => null,
'container' => null,
'folder' => null,
'file_extension' => null,
'file_width' => null,
'file_length' => null,
]
];
return $products[$imageNumber%2];
});