mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-22 23:25:23 +00:00
Use instance in query if there are more than one instances and add tests
This commit is contained in:
@@ -98,7 +98,7 @@ class Cart
|
||||
$instance = $instance->getInstanceIdentifier();
|
||||
}
|
||||
|
||||
$this->instance = 'cart.'.$instance;
|
||||
$this->instance = 'cart.' . $instance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -831,7 +831,11 @@ class Cart
|
||||
*/
|
||||
private function storedCartWithIdentifierExists($identifier)
|
||||
{
|
||||
return $this->getConnection()->table($this->getTableName())->where('identifier', $identifier)->where('instance', $this->currentInstance())->exists();
|
||||
$data = ['identifier' => $identifier];
|
||||
if ($this->countInstances() > 1) {
|
||||
$data['instance'] = $this->currentInstance();
|
||||
}
|
||||
return $this->getConnection()->table($this->getTableName())->where($data)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user