|
|
@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Model;
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
+use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
@@ -45,6 +46,11 @@ class Order extends Model
|
|
|
return $this->hasMany(ProductSKU::class, 'order_id', 'id');
|
|
|
}
|
|
|
|
|
|
+ public function products(): HasManyThrough
|
|
|
+ {
|
|
|
+ return $this->hasManyThrough(Product::class, ProductSKU::class, 'order_id', 'id');
|
|
|
+ }
|
|
|
+
|
|
|
public function maf_orders(): BelongsTo
|
|
|
{
|
|
|
return $this->belongsTo(MafOrder::class, 'maf_order_id');
|