コード例 #1
0
 public function update(TournamentLocationRequest $request, TournamentLocation $tournament_locations)
 {
     foreach ($request->all()['data']['attributes'] as $key => $value) {
         if (isset($tournament_locations->{$key})) {
             $tournament_locations->{$key} = $value;
         }
     }
     // fetch tournament
     $tournament = Tournament::findOrFail($request->all()['data']['relationships']['tournament']['data']['id']);
     $tournament_locations->tournament_id = $tournament->id;
     $tournament_locations->save();
     $resource = new Item($tournament_locations, new TournamentLocationTransformer(), 'tournament-feeds');
     return $this->fractal()->createData($resource)->toJson();
 }