/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['coordinates' => 'required|digits:8', 'start_date' => 'date|required']);
     //        $location = Location::pickUnused(1);
     //        $target = Target::fromLocationWithCoordinates($location->id, $faker->randomNumber(8));
     //        $decoys = Target::decoysFromLocations(Location::pickUnused(4));
     //        $experiment = Experiment::fromTargetAndDecoys($target, $decoys);
     //        $experiment->start_date = Carbon\Carbon::now()->addDays(7);
     //        $experiment->save();
     // create the target
     $target = Target::fromLocationWithCoordinates($request->location_id, $request->coordinates);
     // pick the decoys
     $decoys = Target::decoysFromLocations(Location::pickUnused(4, array($target->location)));
     // create the experiment, attach target and decoys
     $experiment = Experiment::fromTargetAndDecoys($target, $decoys);
     $experiment->start_date = $request->start_date;
     $experiment->save();
     // redirect to experiments list
     return redirect('/experiments');
 }