Sentinel:: Help

Published 2 years ago by madsynn

How can i get the user email using sentinel?

Sentinel::getUser()->email

Also this is not working can anyone help me with the way it should work please.

  if (Sentinel::getUser()) {
            $cart = Sentinel::getUser()->cart;
        }
madsynn

@wallyjaw Thanks for your reply but not quite what i need. I will post my whole function for you to see. Maybe you can see my error.


    public static function getPageInfo(&$cart,&$total)
    {
        if (Sentinel::check()) {
            $cart = Sentinel::getUser()->cart;
        } else {
            $cart = new Collection;
            if (Session::has('cart')) {
                foreach (Session::get('cart') as $item) {
                    $elem = new Cart;
                    $elem->product_id = $item['product_id'];
                    $elem->amount = $item['quantity'];
                    if (isset($item['options'])) {
                        $elem->options = $item['options'];
                    }
                    $cart->add($elem);
                }
            }
        }
        $total = 0;
// THIS IS WHERE I AM GETTING AN ERROR IS KEEPS SAYING 
// ErrorExceptionapp/Ecommerce/helperFunctions.php in handleError

        foreach ($cart as $item) {
            $total += $item->product->price*$item->amount;
        }
    }
madsynn

Anyone?

Please sign in or create an account to participate in this conversation.