You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
<?php
|
|
|
|
/** @var Factory $factory */
|
|
|
|
use App\Models\File;
|
|
use Faker\Generator as Faker;
|
|
|
|
$factory->define(File::class, function (Faker $faker) {
|
|
$mimes = ['application/pdf', 'video/mp4', 'image/png', 'image/jpeg', 'audio/x-wav'];
|
|
$extensions = ['pdf', 'mp4', 'png', 'jpg', 'wav'];
|
|
$groups = [
|
|
'pdf' => 'pdf',
|
|
'mp4' => 'video',
|
|
'png' => 'image',
|
|
'jpg' => 'image',
|
|
'wav' => 'audio',
|
|
];
|
|
$sizes = [1, 5, 128, 256, 1024, 2048];
|
|
$rand_type = $faker->numberBetween(0, 4);
|
|
return [
|
|
'user_id' => $faker->numberBetween(1, 200),
|
|
'business_id' => $faker->numberBetween(1, 200),
|
|
'project_id' => $faker->numberBetween(1, 200),
|
|
'attached_to_id' => $faker->numberBetween(1, 100),
|
|
'attached_to_table' => enum('tables.tasks.id'),
|
|
'disk' => 's3',
|
|
'original_name' => $faker->words(1, true),
|
|
'name' => $faker->words(1, true),
|
|
'extension' => $extension = $extensions[$rand_type],
|
|
'mime' => $mimes[$rand_type],
|
|
'group' => $groups[$extension],
|
|
'size' => $sizes[$faker->numberBetween(0, 5)],
|
|
'description' => $faker->text,
|
|
];
|
|
});
|