get(); $clients = User::query()->where('role', UserRole::CLIENT)->get(); for ($i = 1; $i <= 10; $i++) { $category = $categories->random(); $client = $clients->random(); Equipment::query()->updateOrCreate( ['inventory_number' => sprintf('INV-%04d', $i)], [ 'name' => fake()->randomElement([ 'Ноутбук Dell Latitude', 'HP ProDesk', 'Cisco Router', 'Brother MFC Printer', 'Lenovo ThinkPad', ]).' '.$i, 'serial_number' => sprintf('SN-%08d', 10000000 + $i), 'category_id' => $category->id, 'client_id' => $client->id, 'purchase_date' => now()->subMonths(rand(6, 48))->toDateString(), 'warranty_until' => now()->addDays(rand(-90, 365))->toDateString(), 'condition' => fake()->randomElement(EquipmentCondition::cases())->value, 'notes' => fake()->sentence(), ] ); } } }