LukePOLO\LaraCart\LaraCart::setInstance PHP Method

setInstance() public method

Sets and Gets the instance of the cart in the session we should be using.
public setInstance ( string $instance = 'default' ) : LaraCart
$instance string
return LaraCart
    public function setInstance($instance = 'default')
    {
        $this->get($instance);
        $this->session->set($this->prefix . '.instance', $instance);
        if (!in_array($instance, $this->getInstances())) {
            $this->session->push($this->prefix . '.instances', $instance);
        }
        $this->events->fire('laracart.new');
        return $this;
    }