'CNT-001'], [ 'vendor_name' => 'Vendor Default', 'start_date' => now()->subMonths(6), 'end_date' => now()->addMonths(6), 'sla_response_hours' => 4, 'sla_resolution_hours' => 24, 'notes' => 'Kontrak default untuk sample aset', ] ); $names = [ 'Laptop Dell XPS 13', 'Printer HP LaserJet', 'Scanner Canon DR-C230', 'Server Dell R740', 'Router Mikrotik CCR', 'Switch Cisco 2960', 'Projector Epson EB-X06', 'Monitor LG 27UL550', 'UPS APC 1500VA', 'Tablet iPad Air', 'Smartphone Samsung S24', 'Kursi Ergonomis', 'Meja Kerja Kayu', 'Lemari Arsip', 'Camera CCTV Hikvision', ]; $imagePool = [ 'https://images.unsplash.com/photo-1517336714731-489689fd1ca8?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1498050108023-c5249f4df085?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1520607162513-77705c0f0d4a?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1498050108023-c5249f4df086?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1518779578993-ec3579fee39f?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1559163499-35d55e4857a8?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1523475472560-d2df97ec485c?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1481277542470-605612bd2d61?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1499951360447-b19be8fe80f5?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1481277542470-605612bd2d60?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1433838552652-f9a46b332c40?auto=format&fit=crop&w=800&q=80', 'https://images.unsplash.com/photo-1504384308090-c894fdcc538d?auto=format&fit=crop&w=800&q=80', ]; foreach ($names as $index => $name) { $asset = $service->create([ 'name' => $name, 'asset_status_id' => $status?->id, 'asset_class_id' => $class?->id, 'asset_category_id' => $category?->id, 'unit_id' => $unit?->id, 'department_id' => $dept?->id, 'person_in_charge_id' => $pic?->id, 'asset_user_id' => $user?->id, 'asset_location_id' => $location?->id, 'warranty_id' => $warranty?->id, 'purchase_date' => now()->subDays(30 + $index), 'cost' => 1000000 + ($index * 250000), 'residual_value' => 500000, 'useful_life_months' => 36, 'depreciation_method' => $index % 2 === 0 ? 'straight_line' : 'diminishing', 'capex_opex' => $index % 3 === 0 ? 'capex' : 'opex', 'vendor_contract_id' => $contract->id, ]); // Download 2 foto berbeda untuk tiap aset dari pool. $pics = collect($imagePool)->shuffle()->take(2); foreach ($pics as $idx => $url) { $response = Http::get($url); if ($response->ok()) { $path = "assets/{$asset->id}/photo-{$idx}.jpg"; Storage::disk('public')->put($path, $response->body()); AssetPhoto::create([ 'asset_id' => $asset->id, 'path' => $path, 'is_primary' => $idx === 0 && $asset->photos()->count() === 0, ]); } } } } }