public function update(TournamentFeedRequest $request, TournamentFeed $tournament_feeds)
 {
     foreach ($request->all()['data']['attributes'] as $key => $value) {
         if (isset($tournament_feeds->{$key})) {
             $tournament_feeds->{$key} = $value;
         }
     }
     // fetch tournament
     $tournament = Tournament::findOrFail($request->all()['data']['relationships']['tournament']['data']['id']);
     $tournament_feeds->tournament_id = $tournament->id;
     $tournament_feeds->save();
     $resource = new Item($tournament_feeds, new TournamentFeedTransformer(), 'tournament-feeds');
     return $this->fractal()->createData($resource)->toJson();
 }
 public function destroy(Tournament $tournaments)
 {
     $tournaments->delete();
     return response()->json('', Response::HTTP_NO_CONTENT);
 }
 public function testPatchTournaments()
 {
     // create user info and convert it to json
     $location = factory(Location::class)->create();
     $location2 = factory(Location::class)->create();
     $tournamentObject = factory(Tournament::class)->create(['location_id' => $location->id]);
     $tournamentObject->name = 'voguetastic';
     $tournamentData = json_encode(['data' => ['type' => 'tournaments', 'attributes' => $tournamentObject->toArray(), 'relationships' => ['location' => ['data' => ['type' => 'locations', 'id' => $location2->id]]]]]);
     $response = $this->callPatch(self::API_URL . $tournamentObject->id, $tournamentData);
     $this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
     $this->assertNotNull($tournament = json_decode($response->getContent())->data);
     $this->assertNotEmpty($tournament->id);
     // test to make sure the user was created
     $updatedTournament = Tournament::findOrFail($tournament->id);
     $this->assertEquals('voguetastic', $updatedTournament->name);
     $this->assertEquals($updatedTournament->location->toArray(), $location2->toArray());
 }