public function scan() { $user_id = Session::get('user_id'); if (!Input::hasFile('file')) { return Response::json(array("result" => "No file")); } $result = ""; $file = Input::file('file'); $destinationPath = public_path() . "/uploads/"; $file_name = date('YmdHis') . '_' . $file->getClientOriginalName(); $uploadSuccess = $file->move($destinationPath, $file_name); if ($uploadSuccess) { $result = Wine::scan($destinationPath . $file_name); if ($result != -2) { $wine = Wine::where('wine_id', $result)->first(); if ($wine != null) { $input = $wine->toArray(); $rating = Rating::createNewRating($input); } } } return Response::json(array("result" => $result)); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $result = Rating::createNewRating($this->_getInput()); return Response::json($result); }