public function postCapture(Request $request)
 {
     // Validation
     $this->validate($request, ['pokemon' => 'required|exists:pokemon,id', 'photo' => 'required|image']);
     // Create a new instance of the Capture model
     $capture = new Capture();
     // Put the data from form into the database
     // Generating the file name
     $fileName = uniqid() . '.' . $request->file('photo')->getClientOriginalExtension();
     // Takes an instance of the intervention image and use its make method
     // To reference the photo take the request and point to its file method and reference the name of the file you want to find
     // Use the resize method and add its width and height
     // The save method, where you want to save
     \Image::make($request->file('photo'))->resize(320, null, function ($constraint) {
         $constraint->aspectRatio();
     })->save('img/captures/' . $fileName);
     $capture->photo = $fileName;
     $capture->user_id = \Auth::user()->id;
     $capture->pokemon_id = $request->pokemon;
     // And save it to the database!
     $capture->save();
     // Find out the name of the pokemon the user just captured
     // Find or fail by default looks for the id and we have the id of the pokemon
     // It is pokemon because the field name was just called pokemon, not id
     $pokemon = Pokemon::findOrFail($request->pokemon);
     return redirect('pokedex/' . $pokemon->name);
 }
 public function postCapture(Request $request)
 {
     $this->validate($request, ['pokemon' => 'required|exists:pokemon,id', 'photo' => 'required|image', 'location' => 'in:Kanto,Hoenn,']);
     // Create a new instance of the capture model
     $capture = new Capture();
     $fileName = uniqid() . '.' . $request->file('photo')->getClientOriginalExtension();
     \Image::make($request->file('photo'))->resize(320, null, function ($contraint) {
         $contraint->aspectRatio();
     })->save('img/captures/' . $fileName);
     $capture->location = $request->location;
     $capture->attack = rand(0, 350);
     $capture->defense = rand(0, 350);
     $capture->photo = $fileName;
     $capture->user_id = \Auth::user()->id;
     $capture->pokemon_id = $request->pokemon;
     $capture->save();
     // Find out the name of the pokemon the user just captured
     $pokemon = Pokemon::findOrFail($request->pokemon);
     return redirect('pokedex/' . $pokemon->name);
 }