PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 All 51 releases
← All changes | app/Models/AttributeRelation.php +18 -1 1.4.0 → 1.7.1 View file →
@@ -31,9 +31,26 @@
31 31 {
32 32 return $this->belongsTo(AttributeTerm::class, 'term_id', 'id');
33 33 }
34 34
35 + public function variation()
36 + {
37 + return $this->belongsTo(ProductVariation::class, 'object_id', 'id');
38 + }
39 +
40 + /**
41 + * The ProductDetail of the product this link's variation belongs to.
42 + * object_id holds a ProductVariation id, never a ProductDetail id, so the
43 + * detail is resolved through the variation's post_id.
44 + */
35 45 public function productDetails()
36 46 {
37 - return $this->belongsTo(ProductDetail::class, 'object_id', 'id');
47 + return $this->hasOneThrough(
48 + ProductDetail::class,
49 + ProductVariation::class,
50 + 'id',
51 + 'post_id',
52 + 'object_id',
53 + 'post_id'
54 + );
38 55 }
39 56 }