You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
797 B
39 lines
797 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class OrderProductItem extends BaseModel
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $guarded = ['id']; //不允许批量赋值的字段
|
|
protected $casts = ['agent_product_spec_id' => 'json', 'product_spec_id' => 'json'];
|
|
|
|
public function __construct(array $attributes = [])
|
|
{
|
|
parent::__construct($attributes);
|
|
//$this->timestamps = false;
|
|
}
|
|
|
|
public function order()
|
|
{
|
|
return $this->belongsTo(Order::class,'order_id','id');
|
|
}
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class,'product_id','id');
|
|
}
|
|
|
|
public function supplier()
|
|
{
|
|
return $this->belongsTo(Supplier::class)->withTrashed();
|
|
}
|
|
|
|
public function agent()
|
|
{
|
|
return $this->belongsTo(Agent::class)->withTrashed();
|
|
}
|
|
}
|