protected function makeResponse($response, $internal = true) { if ($this->isServer and ($response === false or $response === E_UNAUTH) and !$this->user(false)) { return Redirect::to(route('vanemart::login') . '?back=' . urlencode(\URI::full()))->with('passthru', 1); } else { return parent::makeResponse($response, $internal); } }
function post_post($id = null) { if ($id = static::idFrom($id)) { return \Vane\Block::execResponse('VaneMart::post@add', array('product', $id), null); } }
Event::listen(VANE_NS . 'checkout.reg_user', function (User $user, array &$options) { $view = Current::expand('mail.user.reg_on_order'); $vars = array_only($options, 'password') + $user->to_array(); Mail::sendTo($user->emailRecipient(), $view, $vars); }); // Fired when an existing user has successfully placed a new order. // //* $options hash - 'order' Order, 'block' Block_Checkout. Event::listen(VANE_NS . 'checkout.old_user', function (User $user, array &$options) { }); // Fired when an order is performed. Follows either checkout.reg_user or // checkout.old_user events. $options are the same as of checkout.old_user. Event::listen(VANE_NS . 'checkout.done', function (User $user, array &$options) { $orderInfo = function ($block, Order $order) { $response = \Vane\Block::execCustom($block, array('args' => $order->id, 'input' => array('code' => $order->password, 'grouped' => 0), 'prepare' => function ($block) { $block->user = false; }, 'response' => true, 'return' => 'response')); return $response->render(); }; $view = Current::expand('mail.checkout.user'); Mail::sendTo($user->emailRecipient(), $view, array('user' => $user->to_array(), 'order' => $options['order']->to_array(), 'orderHTML' => $orderInfo('VaneMart::order@show', $options['order']), 'goodsHTML' => $orderInfo('VaneMart::order@goods', $options['order']))); }); Event::listen(VANE_NS . 'checkout.done', function (User $user, array &$options) { Cart::clear(); }); /*----------------------------------------------------------------------- | FILE BLOCK |----------------------------------------------------------------------*/ // Fired when a file download has been requested. If $file's attributes were changed // during event processing the model will be saved automatically. // If it returns non-null it's considered an exceptional case (e.g. access problem)
function post_post($id = null) { return \Vane\Block::execResponse('VaneMart::post@add', array('order', $id), null); }