/** * @param $building_name * @param $street * @param \Plans\Http\Requests\AddFileRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store($building_name, $street, AddFileRequest $request) { $files = head($request->file('files')); $file = Plan::fromFile($files, $request); Building::locatedAt($building_name, $street)->addFile($file); return \Response::json(['success' => true, 'message' => ' File has been added.']); }
/** * Update the specified resource in storage. * * @param int $id * @param \Plans\Http\Requests\BuildingRequest $request * @return \Illuminate\Http\Response */ public function update($id, BuildingRequest $request) { Building::find($id)->update($request->all()); return Redirect('buildings'); }
/** * @param $building_name * @param $street * @param \Plans\Http\Requests\AddPictureRequest $request */ public function store($building_name, $street, AddPictureRequest $request) { $building = Building::locatedAt($building_name, $street); $photo = $request->file('file'); (new AddPictureToBuilding($building, $photo))->save(); }