本文整理匯總了PHP中customer::current方法的典型用法代碼示例。如果您正苦於以下問題:PHP customer::current方法的具體用法?PHP customer::current怎麽用?PHP customer::current使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類customer
的用法示例。
在下文中一共展示了customer::current方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Require administrator login
* @Developer brandon
* @Date Oct 11, 2010
*/
public function __construct()
{
parent::__construct();
$this->template = View::factory('layouts/admin');
meta::set_title(store::name() . ' | Admin | ' . ucwords(Router::$controller));
// Set the route for updating and creating files
Kohana::config_set('routes.base_crud_route', 'admin/');
// Require an admin login if we are in production.
if (IN_PRODUCTION) {
customer::require_admin_login();
}
ORM::factory('audit_trail')->create(array('user_id' => customer::current(), 'store_id' => store::get(), 'controller' => Router::$controller, 'method' => Router::$method, 'object_id' => $this->input->post('id')));
}
示例2: get
/**
* Get the cart
* @Developer brandon
* @Date Oct 20, 2010
*/
public static function get()
{
if (customer::logged_in()) {
return customer::current()->load_cart();
} else {
if (Session::instance()->get('cart_' . store::get())) {
return ORM::factory('cart', Session::instance()->get('cart_' . store::get()));
} else {
$cart = ORM::factory('cart');
$cart->save();
Session::instance()->set('cart_' . store::get(), (string) $cart);
return $cart;
}
}
}