code: public function getWasPurchasedAttribute()
      {
          if (Auth::guest()) return false;
          return Auth::user()
              ->orders()
              ->whereSKU($this->attributes['sku'])
              ->whereStatusIn(config('shop.order_status_purchase'))
              ->count() > 0;
      }
docs: Returns flag indicating if item was purchased by user.
  
  @return bool