Ejemplo n.º 1
0
 public function store(Request $req, JsonResponse $res)
 {
     $type = $req->json('data.type');
     $attrs = $req->json('data.attributes');
     $game = $this->game->create($attrs);
     return new JsonResponse(['data' => $this->serializeGame($game)]);
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("TRUNCATE TABLE games RESTART IDENTITY CASCADE");
     $games = [['name' => 'Donkey Kong'], ['name' => 'Mario Kart']];
     foreach ($games as $game) {
         Game::create($game);
     }
 }
Ejemplo n.º 3
0
 public function testGameDelete()
 {
     Game::create(['name' => $this->gameName]);
     Game::create(['name' => $this->gameNameTwo]);
     $this->json('DELETE', 'games/1');
     $this->assertResponseStatus(204);
     $this->assertEquals(1, Game::count());
 }
Ejemplo n.º 4
0
 public function setUp()
 {
     parent::setUp();
     $this->game = Game::create($this->gameAttrs);
     $this->gameTwo = Game::create($this->gameAttrsTwo);
 }