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.
 
 

67 lines
1.3 KiB

<?php
namespace App\Model\v3;
use App\Model\Model;
class Order extends Model
{
protected $table = 'lanzu_order';
protected $appends = [
'created_at_text',
'updated_at_text',
];
protected $fillable = [
'order_main_id',
'user_id',
'store_id',
'refund_time',
'status',
'money',
'oid',
'order_num',
'refuse_refund_note',
'note',
'created_at',
'updated_at',
'deleted_at',
'refund_note',
];
public function getCreatedAtTextAttribute()
{
return date('Y-m-d H:i:s', $this->attributes['created_at']);
}
public function getUpdatedAtTextAttribute()
{
return date('Y-m-d H:i:s', $this->attributes['updated_at']);
}
public function orderGoods()
{
return $this->hasMany(OrderGoods::class, 'order_id', 'id');
}
public function market()
{
return $this->belongsTo(Market::class, 'market_id', 'id');
}
public function orderMain()
{
return $this->belongsTo(OrderMain::class, 'order_main_id', 'global_order_id');
}
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
public function store()
{
return $this->belongsTo(Store::class, 'store_id', 'id')->withTrashed();
}
}