1234567891011121314151617181920212223242526 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class OrderGoods extends Model
- {
- //定义表
- protected $table = "order_goods";
- //定义主键
- protected $primaryKey = "id";
- protected $fillable = ['order_id','goods_id','sku_id','reward_id','breakup_id','price','manual_id','num','totalprice'];
- public function order()
- {
- return $this->belongsTo('App\Models\Order','order_id','id')->withTrashed();
- }
- public function goods()
- {
- return $this->hasOne('App\Models\Goods','id','goods_id')->withTrashed();
- }
- public function orderbreakup()
- {
- return $this->belongsTo('App\Models\OrderBreakup','breakup_id','id');
- }
- }
|