66 lines
1.8 KiB
PHP
66 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\DisplayMedia;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<DisplayMedia>
|
|
*/
|
|
class DisplayMediaFactory extends Factory
|
|
{
|
|
protected $model = DisplayMedia::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'filename' => fake()->word().'.webp',
|
|
'disk' => 'public',
|
|
'path' => 'display-media/test/'.fake()->uuid().'.webp',
|
|
'external_url' => null,
|
|
'source_type' => 'upload',
|
|
'type' => 'image',
|
|
'mime_type' => 'image/webp',
|
|
'file_size' => fake()->numberBetween(10000, 5000000),
|
|
'title' => fake()->sentence(3),
|
|
'collection' => fake()->randomElement(['immobilien', 'moebel', 'brand', null]),
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
public function video(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'filename' => fake()->word().'.mp4',
|
|
'path' => 'display-media/test/'.fake()->uuid().'.mp4',
|
|
'type' => 'video',
|
|
'mime_type' => 'video/mp4',
|
|
'file_size' => fake()->numberBetween(1000000, 50000000),
|
|
]);
|
|
}
|
|
|
|
public function external(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'filename' => fake()->word().'.jpg',
|
|
'disk' => 'public',
|
|
'path' => null,
|
|
'external_url' => 'https://drive.google.com/file/d/'.fake()->uuid().'/view',
|
|
'source_type' => 'external',
|
|
'file_size' => 0,
|
|
'mime_type' => null,
|
|
]);
|
|
}
|
|
|
|
public function externalVideo(): static
|
|
{
|
|
return $this->external()->state(fn () => [
|
|
'filename' => fake()->word().'.mp4',
|
|
'type' => 'video',
|
|
]);
|
|
}
|
|
}
|