/** * Run the database seeds. * * @return void */ public function run() { Resource::unguard(); Resource::create(['id' => '1', 'name' => 'Iron Ore']); Resource::create(['id' => '2', 'name' => 'Stone']); Resource::create(['id' => '3', 'name' => 'Coal']); Resource::create(['id' => '4', 'name' => 'Rubble']); Resource::create(['id' => '5', 'name' => 'Steel Bar']); Resource::create(['id' => '6', 'name' => 'Event']); Resource::reguard(); $this->command->info('Resource table seeded!'); }
public function getStock($players) { $display = []; for ($i = 0; $i < 7; $i++) { $display[] = Resource::find(1); } for ($i = 0; $i < 4; $i++) { $display[] = Resource::find(2); } $display[] = Resource::find(3); $ary = []; switch ($players) { case 1: for ($i = 0; $i < 16; $i++) { $ary[] = Resource::find(1); } for ($i = 0; $i < 10; $i++) { $ary[] = Resource::find(2); } for ($i = 0; $i < 6; $i++) { $ary[] = Resource::find(3); } for ($i = 0; $i < 4; $i++) { $ary[] = Resource::find(6); } break; case 2: //resources the same a for 3 player //resources the same a for 3 player case 3: for ($i = 0; $i < 20; $i++) { $ary[] = Resource::find(1); } for ($i = 0; $i < 11; $i++) { $ary[] = Resource::find(2); } for ($i = 0; $i < 14; $i++) { $ary[] = Resource::find(3); } for ($i = 0; $i < 5; $i++) { $ary[] = Resource::find(6); } break; case 4: for ($i = 0; $i < 27; $i++) { $ary[] = Resource::find(1); } for ($i = 0; $i < 16; $i++) { $ary[] = Resource::find(2); } for ($i = 0; $i < 14; $i++) { $ary[] = Resource::find(3); } for ($i = 0; $i < 5; $i++) { $ary[] = Resource::find(6); } break; case 5: //defaulting to 5 player levels //defaulting to 5 player levels default: for ($i = 0; $i < 33; $i++) { $ary[] = Resource::find(1); } for ($i = 0; $i < 20; $i++) { $ary[] = Resource::find(2); } for ($i = 0; $i < 14; $i++) { $ary[] = Resource::find(3); } for ($i = 0; $i < 5; $i++) { $ary[] = Resource::find(6); } break; } $deck = Deck::create(collect($ary)); $deck->put(Deck::DISPLAY, collect($display)); return $deck; }