public function index($format, $year, $month, $day) { $date = $this->createDate($year, $month, $day); $photo = new Photo($date); if ($photo->exists() === false) { abort(404); } if (array_key_exists($format, $photo->maxSizes) === false) { abort(400); } $filePath = $photo->getPath($format, true); return response()->download($filePath, $photo->getDownloadName()); }