/** * Store a newly created resource in storage. * * @param $album_id * @param Request $request * @param PhotoForm $photoForm * @return Response */ public function store($album_id, Request $request, PhotoForm $photoForm) { $photoForm->validate($request->only('photo')); $album = Album::findOrFail($album_id); $photo = Photo::fromForm($request->file('photo'), $album->name); $this->albumRepo->storePhotoInAlbum($album, $photo); return back(); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $album = Album::findOrFail($id); return View('users.albums.album-show', array('album' => $album)); }
/** * Store photo in album * * @param Album $album * @param Photo $photo */ public function storePhotoInAlbum(Album $album, Photo $photo) { $album->photos()->save($photo); }