Пример #1
0
 protected function cart()
 {
     // Make sure that the cart instance is stored
     $instance = $this->cart->getInstance();
     if (!($cart = $this->user->cart()->whereInstance($instance)->first())) {
         $cart = $this->user->cart()->create(compact('instance'));
     }
     return $cart;
 }
Пример #2
0
 /**
  * Returns the user cart associated to the given cart instance.
  *
  * @param  string  $instance
  * @return \App\Models\Cart
  */
 protected function cart($instance)
 {
     if (!($cart = $this->user->cart()->whereInstance($instance)->first())) {
         $cart = $this->user->cart()->create(compact('instance'));
     }
     return $cart;
 }