Пример #1
0
 /**
  * @param Request $request
  * @return \Response
  */
 public function login(Request $request)
 {
     if ($request->has('identifier') && $request->has('password')) {
         switch (\Auth::verify(['identifier' => $request->get('identifier'), 'password' => $request->get('password')], $request->has('remember'))) {
             case Verify::SUCCESS:
                 \Session::put('background', auth()->user()->background);
                 return redirect()->back()->with('success', 'Login successful');
             case Verify::INVALID_CREDENTIALS:
                 return redirect()->back()->with('error', 'Invalid credentials');
             case Verify::DISABLED:
                 $user = User::whereUsername($request->get('identifier'))->orWhere('email', $request->get('identifier'))->first();
                 if ($user->banend->eq(Carbon::create(0, 0, 0, 0, 0, 0))) {
                     return redirect()->back()->with('error', 'You are permanently banned for \'' . $user->banreason . '\'.');
                 }
                 // if ban expired unban and relogin.
                 if ($user->banend->lt(Carbon::now())) {
                     $user->banend = null;
                     $user->disabled = 0;
                     $user->banreason = null;
                     $user->save();
                     return $this->login($request);
                 }
                 return redirect()->back()->with('error', 'You are banned for another ' . $user->banend->diffForHumans(null, true) . '. Reason: \'' . $user->banreason . '\'');
             case Verify::UNVERIFIED:
                 return redirect()->back()->with('error', 'Please verify your account');
         }
     }
     return redirect()->back()->with('error', 'Missing credentials');
 }
Пример #2
0
 public function get_instagram()
 {
     // make sure user is logged in
     if (!\Auth::user()) {
         return \Redirect::to('/')->withInput()->withErrors('You must be logged in to access the Instagram panel.');
     }
     // configure the API values
     $auth_config = array('client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'redirect_uri' => REDIRECT_URI);
     // create a new Auth object using the config values
     $auth = new \Instagram\Auth($auth_config);
     // authorize app if not already authorized
     if (!\Input::get('code')) {
         $auth->authorize();
     }
     // get the code value returned from Instagram
     $code = \Input::get('code');
     $title = 'ImgHost - Instagram';
     // save the access token if not already saved
     if (!\Session::get('instagram_access_token')) {
         \Session::put('instagram_access_token', $auth->getAccessToken($code));
     }
     // create a new Instagram object
     $instagram = new \Instagram\Instagram();
     // set the access token on the newly created Instagram object
     $instagram->setAccessToken(\Session::get('instagram_access_token'));
     // get the ID of the authorized user
     $current_user = $instagram->getCurrentUser();
     // access the media of the authorized user
     $media = $current_user->getMedia();
     $db_images = \DB::table('images')->get();
     return \View::make('instagram')->with('title', $title)->with('instagram_images', $media)->with('db_images', $db_images);
 }
Пример #3
0
 public function doLogin(Request $request)
 {
     // dd($request);
     //get the users credentials
     $credentials = ['login' => $request->email];
     //check if there is a match for the email and pword provided
     $user = \Sentinel::findByCredentials($credentials);
     //if there is no match redirect to login page ith input
     if (is_null($user)) {
         // dd($user);
         session()->flash('flash_message', 'Login failure.');
         session()->flash('flash_message_important', true);
         return \Redirect::back()->withInput();
     }
     //attempt to login
     $login = isset($request->remember_me) && $request->remember_me == 1 ? $user = \Sentinel::login($user) : ($user = \Sentinel::login($user));
     // store user info in session
     $user = \Sentinel::getUser();
     \Session::put('user', $user);
     //store user's role in session
     $roles = [];
     foreach ($user->roles as $role) {
         $roles[] = $role;
     }
     \Session::put('roles', $roles);
     //store session and term info in session
     $term_info = DB::table('current_term')->orderBy('created_at', 'desc')->first();
     if (null !== $term_info) {
         \Session::put(['current_session' => $term_info->session, 'current_term' => $term_info->term]);
     }
     return \Redirect::intended();
 }
Пример #4
0
 public function registro(Request $request)
 {
     $usuario = Usuario::existe($request->input('usuario'));
     $error_registro = false;
     if (count($usuario) == 0) {
         if (strlen(str_replace("\"", "", str_replace("'", "", $request->input('pass1')))) > 0 && strlen(str_replace("\"", "", str_replace("'", "", $request->input('pass2')))) > 0) {
             if (strcmp(str_replace("\"", "", str_replace("'", "", $request->input('pass1'))), str_replace("\"", "", str_replace("'", "", $request->input('pass2')))) == 0) {
                 $id_usuario = Usuario::registrarUsuario($request);
                 \Session::put('logeado', true);
                 \Session::put('usuario', $request->input('usuario'));
                 \Session::put('id_usuario', $id_usuario);
                 \Session::put('carrito', array());
                 \Session::put('total_compra', 0);
                 return \Redirect::to('/')->with(array('registro_exitoso' => true, 'mensaje' => 'Felicidades, su cuenta ha sido creada'));
             } else {
                 $error_registro = true;
                 return \Redirect::back()->with(array('error_registro' => $error_registro, 'mensaje' => 'Las contraseñas no coinciden.'));
             }
         } else {
             $error_registro = true;
             return \Redirect::back()->with(array('error_registro' => $error_registro, 'mensaje' => 'Las contraseñas no pueden estar vacias.'));
         }
     } else {
         $error_registro = true;
         return \Redirect::back()->with(array('error_registro' => $error_registro, 'mensaje' => 'El nombre de usuario ya existe.'));
     }
 }
Пример #5
0
 public function delete(Product $product)
 {
     $cart = \Session::get('cart');
     unset($cart[$product->slug]);
     \Session::put('cart', $cart);
     return redirect()->route('cart-show');
 }
Пример #6
0
 public function __construct()
 {
     $this->middleware('ipblocked');
     $driver = config('database.default');
     $database = config('database.connections');
     $this->db = $database[$driver]['database'];
     $this->dbuser = $database[$driver]['username'];
     $this->dbpass = $database[$driver]['password'];
     $this->dbhost = $database[$driver]['host'];
     if (\Auth::check() == true) {
         if (!\Session::get('gid')) {
             \Session::put('uid', \Auth::user()->id);
             \Session::put('gid', \Auth::user()->group_id);
             \Session::put('eid', \Auth::user()->email);
             \Session::put('ll', \Auth::user()->last_login);
             \Session::put('fid', \Auth::user()->first_name . ' ' . \Auth::user()->last_name);
             \Session::put('themes', 'sximo-light-blue');
         }
     }
     if (!\Session::get('themes')) {
         \Session::put('themes', 'sximo');
     }
     if (defined('CNF_MULTILANG') && CNF_MULTILANG == 1) {
         $lang = \Session::get('lang') != "" ? \Session::get('lang') : CNF_LANG;
         \App::setLocale($lang);
     }
     $data = array('last_activity' => strtotime(Carbon::now()));
     \DB::table('tb_users')->where('id', \Session::get('uid'))->update($data);
 }
Пример #7
0
 private function autoLogin()
 {
     try {
         if (\Session::has('userID')) {
         } else {
             //try set session from cookies if no session
             if (!empty(\Cookie::get('userID'))) {
                 $field = array('field' => '_id', 'value' => (string) \Cookie::get('userID'));
                 if (Auth::isExists($field)) {
                     \Session::put('userID', \Cookie::get('userID'));
                     //
                     //return \Response::make()->withCookie(\Cookie::make('userID', \Cookie::get('userID') , self::COOKIE_EXPIRE));
                 } else {
                     throw new AuthCheckException('username', 'auth.username.doesnt.exist');
                 }
             } else {
                 //\Session::forget('userID')->withCookie(\Cookie::forget('userID'))->withCookie(\Cookie::forget('userID'));
                 throw new AuthCheckException('userid', 'auth.userid.doesnt.exist');
             }
         }
     } catch (Exception $e) {
         $return = \Response::json(["message" => "Session logout!"], 400);
         \Session::forget('userID');
         return $return->withCookie(Cookie::forget('userID'))->withCookie(Cookie::forget('userID'));
     }
 }
 public function addTask(Request $request)
 {
     $parseTask = new ParseObject("Task");
     $parseCropQuery = new ParseQuery("Crop");
     $parseCropQuery->equalTo("cropName", $request->input('crop'));
     $crop = $parseCropQuery->first();
     $parseQuery = new ParseQuery("Task");
     $parseQuery->equalTo("cropName", $crop);
     $parseQuery->equalTo("taskDesc", $request->input('taskName'));
     if ($parseQuery->count() > 0) {
         return redirect('/tasks');
     }
     $parseTask->set("cropName", $crop);
     $parseTask->set("taskDesc", $request->input('taskName'));
     $parseTask->set("taskDuration", $request->input('taskDuration'));
     $parseTask->set("taskStart", $request->input('taskStart'));
     try {
         $parseTask->save();
         \Session::put('message', 1);
         return redirect('tasks');
     } catch (ParseException $e) {
         \Session::put('message', -1);
         return redirect('tasks');
     }
 }
Пример #9
0
 public function update(Product $product, $quantity)
 {
     $cart = \Session::get('cart');
     $cart[$product->slug]->quantity = $quantity;
     \Session::put('cart', $cart);
     return redirect()->route('cart-show');
 }
 public function login()
 {
     $aRequest = \Input::all();
     $sUsername = $aRequest['username'];
     $sPassword = $aRequest['password'];
     //Check if there's a user with this name, if yes, get all needed information for them
     $aResult = DB::table('users')->where(array('username' => $sUsername))->get(array('*'));
     if (!empty($aResult)) {
         //If execution reached here then the user is normal user.
         $sUserType = 'user';
     }
     if (empty($aResult)) {
         //Check if the user is a restaurant
         $aResult = DB::table('restaurants')->where(array('username' => $sUsername))->get(array('*'));
         $sUserType = 'restaurant';
         \Session::put('loggedin', 'true');
         \Session::put('username', $sUsername);
         \Session::put('id_user', $aResult[0]->id_restaurant);
         \Session::put('user_type', $sUserType);
         //PUT THE SESSION FOR THE RESTAURANT
         return redirect()->intended('/');
     }
     if (empty($aResult)) {
         return redirect('login')->withErrors('User not found!');
     }
     if (Hash::check($sPassword, $aResult[0]->password)) {
         \Session::put('loggedin', 'true');
         \Session::put('username', $sUsername);
         \Session::put('id_user', $aResult[0]->id_user);
         \Session::put('user_type', $sUserType);
         return redirect()->intended('/');
     } else {
         return redirect('login')->withErrors(['Password is wrong!!', 'Error']);
     }
 }
Пример #11
0
 public function index2()
 {
     $level = null;
     if (empty(Auth::user()->level->nama)) {
         \Session::put('error', 'You are not authorized!');
         return \Redirect('logout');
     } else {
         $level = Auth::user()->level->nama;
     }
     if ($level == 'Admin') {
         return View('members.admin.index');
     }
     if ($level == 'Supervisor') {
         return Redirect::route('members.supervisor.laporan.index');
     }
     if ($level == 'Technician') {
         return Redirect::route('members.technician.index');
     }
     if ($level == 'User') {
         return Redirect::route('members.user.laporan.index');
     }
     if ($level == 'Data Entry') {
         return View('members.dataentry.index');
     }
     if ($level == null) {
         return Redirect::route('logout');
     }
 }
 public function create(Todo $todo)
 {
     $text = Input::get('text');
     if (!$todo->createTodo($text, false)) {
         Session::put("error", "Kon todo niet aanmaken");
     }
     return redirect('todo');
 }
Пример #13
0
 /**
  * Applies a filter
  * 
  * @param \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function filter(Request $request)
 {
     $filter = $request->input('filter');
     \Session::put('filter', $filter);
     \Session::flash('status', 'The filter has been updated');
     // Indicate success
     return '1';
 }
Пример #14
0
 public function catch_all($param)
 {
     if (view()->exists('static.' . $param)) {
         \Session::put('path', $param);
         $title = prepTitle($param, 'Kastner & Pallavicino');
         return view('static.' . $param, compact('title'));
     }
     // return $param;
     abort(404);
 }
Пример #15
0
 public function update(Product $product, $quantity)
 {
     $cart = \Session::get('cart');
     //crear variable de sesion.
     $cart[$product->slug]->quantity = $quantity;
     //asginar la cant q el usuario eligio al array de var local
     \Session::put('cart', $cart);
     //actualizar variable de sesion con datos de la vaiable local
     return redirect()->route('cart-show');
 }
Пример #16
0
 public function loginAPI()
 {
     if (Input::get('name') == "admin" && sha1(Input::get('password')) === "05fe7461c607c33229772d402505601016a7d0ea") {
         $return = \Response::json(["status" => "ok", "message" => "Sucessfull Login!"], 200);
         \Session::put('tempuser.token', sha1(Input::get('password')));
         return $return;
     } else {
         return \Response::json(['error' => true, 'message' => "Error, Invalid name or password"], 400);
     }
 }
Пример #17
0
 public function toAssume($id)
 {
     $organization = Organization::findOrFail($id);
     if (session('organization') == null) {
         \Session::put('organization', $organization);
         return redirect('/home/organizations/home');
     } else {
         \Session::forget('organization');
         return 'you have forgotten the organization';
     }
 }
Пример #18
0
 /**
  * Processes the Sort Posts request.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function postSort(Request $request)
 {
     // validate request
     $this->validate($request, ['sort_by' => 'required']);
     // parse request
     $sort_by = $request->sort_by;
     // store $sort_by in the global session
     \Session::put('sort_by', $sort_by);
     // redirect to the previous page
     $view = back();
     return $view;
 }
Пример #19
0
 public function postPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $items = array();
     $subtotal = 0;
     $cart = \Session::get('cart');
     $currency = 'USD';
     foreach ($cart as $producto) {
         $item = new Item();
         $item->setName($producto->name)->setCurrency($currency)->setDescription($producto->extract)->setQuantity($producto->quantity)->setPrice($producto->price);
         $items[] = $item;
         $subtotal += $producto->quantity * $producto->price;
     }
     $item_list = new ItemList();
     $item_list->setItems($items);
     $details = new Details();
     $details->setSubtotal($subtotal);
     //->setShipping(0);
     $total = $subtotal;
     $amount = new Amount();
     $amount->setCurrency($currency)->setTotal($total)->setDetails($details);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Pedido de prueba en mi Laravel App Store');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Ups! Algo salió mal');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::route('cart-show')->with('error', 'Ups! Error desconocido.');
 }
Пример #20
0
 public function getIdPrograma()
 {
     $get_eje = \DB::table('eje_estrategico')->select('id')->where('id_plan_de_desarrollo', '=', \Session::get('id_plan'))->get();
     $id_eje = array_map(function ($get_id_eje) {
         return $get_id_eje->id;
     }, $get_eje);
     $get_programa = \DB::table('programa')->select('id')->whereIn('id_eje_estrategico', $id_eje)->get();
     $id_programa = array_map(function ($get_id_program) {
         return $get_id_program->id;
     }, $get_programa);
     \Session::put('id_programa', $id_programa);
     return $id_programa;
 }
 public function getVisuri(Request $req)
 {
     $sort = $req->input('sort', null);
     $query = Dream::orderBy('created_at');
     if (!is_null($sort)) {
         $query->orderBy($sort);
         \Session::put('dreams_sort', $sort);
     } elseif (\Session::has('dreams_sort')) {
         $query->orderBy(\Session::get('dreams_sort'));
     }
     $data['models'] = $query->paginate($this->pageSize);
     return view('administration.visuri', $data);
 }
 public function getVisuri(Request $req)
 {
     $sort = $req->input('sort', null);
     $week = $req->input('week', null);
     $page = $req->input('page', 0);
     date_default_timezone_set('Europe/Bucharest');
     $startDate = new Carbon(\Config::get('constants.start_date'));
     $currentDate = Carbon::now();
     $endDate = $currentDate;
     $daysDiff = $currentDate->diff($startDate)->days;
     $weeksDiff = floor($daysDiff / 7);
     if (is_null($week)) {
         $week = $weeksDiff;
     }
     if (is_numeric($week) && $week < $weeksDiff) {
         $startDate->addWeeks($week);
         $endDate = $startDate->copy();
         $endDate->addWeek()->subDay();
     } else {
         if ($weeksDiff > 0) {
             $startDate->addWeeks($weeksDiff);
         }
     }
     $query = Dream::with('user');
     $query = Dream::whereBetween('approved_at', [$startDate, $endDate]);
     $totalPages = $query->count() / $this->pageSize;
     if (is_numeric($page) && $page > 0 && $page <= $totalPages) {
         $query->skip($page * $this->pageSize);
     }
     if (!is_null($sort)) {
         \Session::put('dreams_sort', $sort);
     }
     if (\Session::has('dreams_sort')) {
         $sort = \Session::get('dreams_sort');
         switch ($sort) {
             case 'approved_at':
                 $data['models'] = $query->orderBy($sort, 'ASC')->take($this->pageSize)->get();
                 break;
             case 'votes':
                 $data['models'] = $query->orderBy($sort, 'DESC')->take($this->pageSize)->get();
                 break;
         }
     } else {
         $data['models'] = $query->take($this->pageSize)->get();
     }
     $data['totalPages'] = $totalPages;
     $data['totalWeeks'] = $weeksDiff;
     $data['currentWeek'] = $week ? $week : $weeksDiff;
     $data['currentPage'] = $page;
     return view('visuri', $data);
 }
Пример #23
0
 public static function handleAction($entity, $action = NULL, $id = NULL)
 {
     if (!$action) {
         $action = "index";
     }
     try {
         if (self::$modelConfig = AdminHelper::modelExists($entity)) {
             if (self::$modelConfig->restrictedAccess && $action != 'ajaxSearch') {
                 $role = \Auth::user()->role;
                 if (!self::$modelConfig->restrictedAccess->{$role}) {
                     \Session::put('accessDenied', true);
                     return \Redirect::route('restricted');
                 }
             }
             self::$entity = $entity;
             $loginRedirect = \Request::get('getIgnore_loginRedirect') ? true : false;
             $settings = false;
             if ($entity == "GtcmsSetting") {
                 if ($action != "index") {
                     throw new \Exception("Invalid action for Settings!");
                 }
                 if (!is_null($id)) {
                     throw new \Exception("You cannot pass ID for Settings!");
                 }
                 $action = "edit";
                 $settings = true;
             }
             if (in_array($action, array('edit', 'view', 'delete'))) {
                 return self::$action($id, false, $settings);
             } else {
                 if (in_array($action, array('add', 'index', 'ajaxMove'))) {
                     return self::$action($loginRedirect);
                 } else {
                     if (in_array($action, array('ajaxSearch'))) {
                         return self::$action();
                     } else {
                         throw new \Exception("Invalid action!");
                     }
                 }
             }
         } elseif ($action == 'ajaxSearch') {
             self::$entity = $entity;
             return self::$action();
         } else {
             throw new \Exception("Model doesn't exist: " . $entity);
         }
     } catch (\Exception $e) {
         return AdminHelper::handleException($e);
     }
 }
Пример #24
0
 public function callback(SocialAccountService $service)
 {
     $providerUser = Socialite::driver('facebook')->user();
     $user = $service->createOrGetUser($providerUser);
     $token = $providerUser->token;
     \Session::put('fb_user_access_token', (string) $token);
     auth()->login($user);
     $userinfo = UserInfo::find($user->id);
     if (empty($userinfo)) {
         return redirect()->to('/profile/create/info');
     } else {
         return redirect()->to('/');
     }
 }
 public function checkSecretKey()
 {
     $key = \Input::get('collectionkey');
     try {
         $collection = \App\Collection::where('secret', $key)->firstOrFail();
     } catch (ModelNotFoundException $e) {
         \Session::flash('errorMsg', 'Secret key not found!');
         return \Redirect::back();
     }
     \Session::put('rightToEdit', $collection->id . "_" . $collection->secret);
     //return $this->showCollectionForEdit();
     return \Redirect::to('collections/edit/' . $collection->id);
     //return \View::make('collectioninfopage')->with('collection', $collection);
 }
Пример #26
0
 public function changeKolvo(Request $request)
 {
     $array = $request->input('change_kolvo');
     $array2 = json_decode($array);
     $id = $array2[1];
     $kolvo = $array2[0];
     $price = \Session::get('product8.' . $id . '.price');
     $returnPrice = $price * $kolvo;
     \Session::put('product8.' . $id . '.kolvo', $kolvo);
     $allPrice = '';
     foreach (\Session::get('product8') as $product) {
         $allPrice += $product['price'] * $product['kolvo'];
     }
     $arr = [$returnPrice, $allPrice];
     return $arr;
 }
Пример #27
0
 public function postLogin(Request $request)
 {
     $validate = \Validator::make($request->all(), ['email' => 'required|email', 'password' => 'required']);
     if ($validate->passes()) {
         $credentials = $request->only('email', 'password');
         if ($this->auth->attempt($credentials, $request->has('remember'))) {
             $user = User::find(Auth::user()->id);
             $user->last_login_time = date('Y-m-d:h:i:s');
             $user->save();
             \Session::put('UserID', Auth::user()->id);
             return Redirect::to(url('dashboard'));
         }
         return redirect(url('/user/login'))->withInput($request->only('email', 'remember'))->withErrors(['success' => false, 'msg' => 'invalid Email or Password!']);
     }
     return redirect(url('/user/login'))->withInput($request->only('email', 'remember'))->withErrors(['success' => false, 'msg' => $validate->messages()->all()]);
 }
 public function postPayment()
 {
     $input_amount = \Input::get('amount');
     $input_user_id = \Input::get('user_id');
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName('Υπηρεσίες freelancing')->setCurrency('EUR')->setQuantity(1)->setPrice($input_amount);
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems(array($item_1));
     $amount = new Amount();
     $amount->setCurrency('EUR')->setTotal($input_amount);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Ειμαι η περιγραφή');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(\URL::route('payment.status'))->setCancelUrl(\URL::route('payment'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setId("2014031400023")->setTransactions(array($transaction));
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo "Exception: " . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     \Session::put('paypal_payment_id', $payment->getId());
     \Session::put('user_id', $input_user_id);
     \Session::put('amount', $input_amount);
     if (isset($redirect_url)) {
         // redirect to paypal
         return \Redirect::away($redirect_url);
     }
     return \Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
Пример #29
-1
 public function tesseract($image_path)
 {
     require_once 'D:\\xampp\\htdocs\\ocr\\vendor\\thiagoalessio\\tesseract_ocr\\TesseractOCR\\TesseractOCR.php';
     $tesseract = new TesseractOCR(public_path() . '/images/' . $image_path);
     $text = $tesseract->recognize();
     Session::put('trans', $text);
     return $text;
 }
Пример #30
-1
 public function comprar()
 {
     if (\Session::get('total_compra') == 0) {
         return \Redirect::back();
     }
     $saldo = Usuario::getSaldo(\Session::get('id_usuario')) - \Session::get('total_compra');
     if ($saldo < 0) {
         return \Redirect::back()->with(['error_compra' => true, 'mensaje' => 'Su saldo no es suficiente.']);
     }
     $id_venta = Venta::venta(\Session::get('id_usuario'), \Session::get('total_compra'));
     Usuario::setSaldo(\Session::get('total_compra'), \Session::get('id_usuario'), 0);
     ProductosVenta::agregarProductoAVenta(\Session::get('carrito'), $id_venta);
     \Session::put('carrito', array());
     \Session::put('total_compra', 0);
     return \Redirect::to('/')->with(['compra_realizada' => true]);
 }