| @@ -155,8 +155,18 @@ | ||
| 155 | 155 | { |
| 156 | 156 | return $this->belongsTo(ProductDownload::class, 'post_id', 'post_id'); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | + /** | |
| 160 | + * All reviews of the product this line item points to — keyed on | |
| 161 | + * post_id, not on the item itself, so whereDoesntHave() over it | |
| 162 | + * expresses "the customer never reviewed this product". | |
| 163 | + */ | |
| 164 | + public function product_reviews() | |
| 165 | + { | |
| 166 | + return $this->hasMany(ProductReview::class, 'post_id', 'post_id'); | |
| 167 | + } | |
| 168 | + | |
| 159 | 169 | public function createItem($orderItems) |
| 160 | 170 | { |
| 161 | 171 | return $this->belongsTo(ProductVariation::class, 'variation_id', 'id'); |
| 162 | 172 | } |