44 lines
1.8 KiB
PHP
44 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Domain\Inventory\Models\SnipeAsset;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/** @extends Factory<SnipeAsset> */
|
|
class SnipeAssetFactory extends Factory
|
|
{
|
|
protected $model = SnipeAsset::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$category = fake()->randomElement(['Portáteis', 'Projetores', 'Fotografia', 'Áudio']);
|
|
$id = fake()->unique()->numberBetween(1000, 99999);
|
|
|
|
return [
|
|
'snipe_asset_id' => $id,
|
|
'asset_tag' => 'EPVC-'.str_pad((string) $id, 5, '0', STR_PAD_LEFT),
|
|
'name' => match ($category) {
|
|
'Portáteis' => fake()->randomElement(['MacBook Air 13', 'Dell Latitude 5440', 'Lenovo ThinkPad E14']),
|
|
'Projetores' => fake()->randomElement(['Projetor Epson EB-FH06', 'Projetor BenQ MH560']),
|
|
'Fotografia' => fake()->randomElement(['Canon EOS R10', 'Kit Sony Alpha 6400']),
|
|
default => fake()->randomElement(['Gravador Zoom H5', 'Kit Rode Wireless GO']),
|
|
},
|
|
'model_id' => fake()->numberBetween(1, 50),
|
|
'model_name' => fake()->bothify('Modelo ##??'),
|
|
'category_id' => array_search($category, ['Portáteis', 'Projetores', 'Fotografia', 'Áudio'], true) + 1,
|
|
'category_name' => $category,
|
|
'manufacturer' => fake()->company(),
|
|
'status_id' => 1,
|
|
'status_name' => 'Pronto a disponibilizar',
|
|
'location_id' => fake()->numberBetween(1, 4),
|
|
'location_name' => fake()->randomElement(['Biblioteca', 'Serviços de Informática', 'Sala de Audiovisuais']),
|
|
'requestable' => true,
|
|
'synced_at' => now(),
|
|
'source_updated_at' => now(),
|
|
'content_hash' => fake()->sha256(),
|
|
'active' => true,
|
|
];
|
|
}
|
|
}
|