public function run() { Server::truncate(); $services = Service::lists('id')->all(); $operating_systems = OperatingSystem::lists('id')->all(); $database_technologies = DatabaseTechnology::lists('id')->all(); foreach ($services as $service) { $limit = rand(2, 20); for ($i = 1; $i < $limit; $i++) { $sites = Site::where('service_id', $service)->lists('id')->all(); $site = $sites[array_rand($sites, 1)]; Server::create(['id' => "{$site}" . str_pad($i, 3, '0', STR_PAD_LEFT), 'name' => "Sample server {$i}", 'enabled' => rand(0, 1), 'description' => "Sample server {$i}", 'site_id' => "{$site}", 'operating_system_id' => array_rand($operating_systems, 1), 'database_technology_id' => array_rand($database_technologies, 1)]); } } }
/** * Run the operating systems table seeds. * * @return void */ public function run() { Dodona\OperatingSystem::truncate(); OperatingSystem::create(['name' => 'Linux']); OperatingSystem::create(['name' => 'Oracle Linux 6.5']); OperatingSystem::create(['name' => 'Oracle Linux 7.0']); OperatingSystem::create(['name' => 'Redhat 4.5']); OperatingSystem::create(['name' => 'Redhat 5.4']); OperatingSystem::create(['name' => 'Redhat 6.5']); OperatingSystem::create(['name' => 'Redhat 7.0']); OperatingSystem::create(['name' => 'CentOS 6.5']); OperatingSystem::create(['name' => 'CentOS 7.0']); OperatingSystem::create(['name' => 'Windows']); OperatingSystem::create(['name' => 'Windows Server 2003']); OperatingSystem::create(['name' => 'Windows Server 2005']); OperatingSystem::create(['name' => 'Windows Server 2008']); OperatingSystem::create(['name' => 'Windows Server 2012']); }