예제 #1
0
 public function destroy($year, $month, $day)
 {
     $date = $this->createDate($year, $month, $day);
     $photo = new Photo($date);
     if ($photo->exists() === false) {
         abort(404);
     }
     $photo->delete();
     return response()->json($photo);
 }
예제 #2
0
 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());
 }