public function addPhoto($zip, $street, Request $request) { $this->validate($request, ['photo' => 'required|mimes:jpg,jpeg,png,bmp']); $photo = Photo::fromfile($request->file('photo'))->upload(); Flyer::LocatedAt($zip, $street)->addPhoto($photo); /* if (! $this->userCreateFlyer($request)) { return $this->unauthorized($request); } $photo = $this->makePhoto($request->file('photo')); Flyer::LocatedAt($zip ,$street) ->addPhoto($photo); */ }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($zip, $street) { //return Flyer::LocatedAt($zip ,$street)->first(); $flyer = Flyer::LocatedAt($zip, $street)->first(); return view('flyers.show', compact('flyer')); }