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.
52 lines
1.5 KiB
52 lines
1.5 KiB
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Collection;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Facades\App;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\File>
|
|
*/
|
|
class FileFactory extends Factory
|
|
{
|
|
use BaseFactory;
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition()
|
|
{
|
|
return [
|
|
"uuid" => app()->uuid,
|
|
"original_name" => fake()->name(),
|
|
"ext" => ['jpg', 'jpeg', 'png', 'webp'][rand(0, 3)],
|
|
"mimetype" => 'image',
|
|
"width" => rand(300, 2000),
|
|
"height" => rand(300, 2000),
|
|
"file_size" => rand(300, 2000),
|
|
"sort" => rand(0, 23),
|
|
"server_path" => '/' . date('y') . '/' . date('m') . '/',
|
|
"alts" => [
|
|
'hello wroldswdfouiwref iuwrhgf ow rgfaw ghfawej',
|
|
'jhsf asduyfsadf sadf safsuf isfjsdfsudifsduiyf sdiuf sd'
|
|
],
|
|
"description" => 'ajsfoisahjfoaspf asduf safsafjsh lh',
|
|
"user_id" => rand(43724, 382348),
|
|
"ip" => "127.0. 0.1",
|
|
// "collection_id" => $collection->id,
|
|
"published_at" => "2022-07-27 09:17:59",
|
|
];
|
|
}
|
|
|
|
|
|
public function dependencyProvider()
|
|
{
|
|
return [
|
|
'collection_id' => Collection::factory()->createQuietly()
|
|
];
|
|
}
|
|
}
|