/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|string', 'number' => 'required|numeric', 'event_id' => 'required|integer']);
     // If any exceptions are thrown any DB operations
     // will be automatically rolled back.
     DB::transaction(function () use($request) {
         $team = new Team();
         $team->name = $request['name'];
         $team->number = $request['number'];
         $team->event()->associate(Event::find($request['event_id']));
         $team->save();
         if (!empty($request['members'])) {
             $this->syncTeamMembers($request, $team);
         }
     });
     flash()->success('Success!', "New team has been created!");
     return redirect(route('admin.weigh-ins.teams.index'));
 }