first()){ self::order_no(); }else{ return $order_no; } } public function orderDetail() { return $this->hasMany(OrderDetail::class,'order_no','order_no'); } public function address() { return $this->hasOne(Address::class,'id','address_id')->withTrashed(); } public function store(){ return $this->hasOne(Store::class,'id','store_id')->withTrashed(); } public function user(){ return $this->hasOne(User::class,'id','user_id')->withTrashed(); } public function cancel() { return $this->hasOne(OrderCancel::class,'order_id','id'); } public function refund() { return $this->hasMany(OrderRefund::class,'order_no','order_no'); } public function getAccountAttribute($value){ return round($value); } }