Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Type::unguard();
     $game = Type::create(['id' => 1, 'name' => 'Base']);
     $actions = Action::where('phase_letter', '>=', 'A')->where('phase_letter', '<=', 'G')->where('min_player', '>=', 1)->where('min_player', '<=', 5)->get()->pluck('id')->toArray();
     $game->actions()->attach($actions);
     $game->contracts()->attach([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]);
     $game->trains()->attach(['1', '1L', '2', '3', '4', '5', '6', '7', '11', '12', '13', '22', '23']);
     $game->stations()->attach([1, 2, 3, 4, 5, 6, 7, 8, 9]);
     Type::reguard();
     $this->command->info('Base Game Created!');
 }
Ejemplo n.º 2
0
 /**
  * Process the new request for a game.
  *
  * @param Request $request  The form request
  * @return Response
  */
 public function postNew(Request $request)
 {
     $user = $request->user();
     $type = Game_Type::find($request->input('game_type_id'));
     $game = new Game();
     $game->no_players = $request->input('no_players');
     $game->creator()->associate($user);
     $game->type()->associate($type);
     $game->save();
     $game->users()->attach($user->id);
     return redirect()->action('GameController@getWaiting', ['game' => $game->id]);
 }