/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!administrator()) { return redirect()->route('user.index'); } $a = app('veer')->administrator_credentials; $a['sites_encoded'] = json_decode($a['sites_watch']); if (!in_array(app('veer')->siteId, (array) $a['sites_encoded']) && !empty($a['sites_watch'])) { return redirect()->route('user.index'); } app('veer')->administrator_credentials['sites_encoded'] = $a['sites_encoded']; app('veer')->administrator_credentials['access_encoded'] = json_decode(app('veer')->administrator_credentials['access_parameters']); return $next($request); }
public function getPrice($product, $bypassUser = false, $custom = null) { if (!empty($custom)) { if (!administrator()) { $custom = null; } } $price = $this->calculator($product, $bypassUser, $custom); $regular_price = $this->currency($product['price'], $product['currency'], $custom); if ($regular_price != $price) { return view(app('veer')->loadedComponents['template'] . ".elements.price-discount")->with('price', $this->priceFormat($price))->with('regular_price', $this->priceFormat($regular_price)); } else { return view(app('veer')->loadedComponents['template'] . ".elements.price-regular")->with('price', $this->priceFormat($price)); } }
/** * Login Post */ public function loginPost() { $save_old_session_id = \Session::getId(); if (\Auth::attempt(array('email' => \Input::get('email'), 'password' => \Input::get('password'), 'banned' => 0, 'sites_id' => app('veer')->siteId))) { \Auth::user()->increment('logons_count'); \Session::put('roles_id', \Auth::user()->roles_id); \Veer\Models\UserList::where('session_id', '=', $save_old_session_id)->update(array('users_id' => \Auth::id())); \Session::put('shopping_cart_items', $this->showUser->getUserLists(app('veer')->siteId, \Auth::id(), app('session')->getId())); if (administrator() == true) { \Veer\Models\UserAdmin::where('id', '=', app('veer')->administrator_credentials['id'])->update(array("sess_id" => \Session::getId(), "last_logon" => now(), "ips" => \Illuminate\Support\Facades\Request::getClientIp(), "logons_count" => app('veer')->administrator_credentials['logons_count'] + 1)); } return \Redirect::intended(); } return $this->login(); // @todo withErrors() }
/** * Order was successful made */ public function success() { if (\Session::has("successfulOrder")) { $orders = $this->showOrder->getOrderWithSite(app('veer')->siteId, \Session::get("successfulOrder"), \Auth::id(), administrator()); if (is_object($orders)) { $orders->load('user', 'userbook', 'userdiscount', 'status', 'delivery', 'payment', 'status_history', 'products', 'bills', 'secrets', 'orderContent'); // @todo do we need to load all information? // @todo downloads for digital products /* do not cache */ return viewx($this->template . '.success-order', array("order" => $orders, "template" => $this->template)); } } return Redirect::route('index'); }