File: /var/www/vhost/disk-apps/agile-selling-wpb/app/OrderProduct.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class OrderProduct extends Model
{
public function order(){
return $this->belongsTo(Order::class);
}
public function products(){
return $this->belongsTo(Product::class, 'product_id')->with('subcategoryProduct');
}
public function product(){
return $this->belongsTo(Product::class)->with('subcategoryProduct','productImages');
}
public function orderProductAttributes()
{
return $this->hasMany(OrderProductAttributes::class)->with('attribute');
}
}