39 lines
913 B
PHP
39 lines
913 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Foto;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Foto>
|
|
*/
|
|
class FotoFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Foto::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$extension = $this->faker->randomElement(['png', 'jpg', 'jpeg']);
|
|
$nombre = $this->faker->word();
|
|
|
|
return [
|
|
'extension' => $extension,
|
|
'tamanio_bytes' => $this->faker->numberBetween(1024, 512000),
|
|
'nombre' => $nombre,
|
|
'mime_type' => "image/{$extension}",
|
|
'ruta' => "fotos/{$nombre}.{$extension}",
|
|
];
|
|
}
|
|
}
|