false, ]; protected $casts = [ 'is_deposit' => 'bool', ]; protected $fillable = [ 'user_id', 'product_id', 'type', 'qty', 'remark', 'revoke_id', 'is_deposit', ]; public function product() { return $this->belongsTo(DealerProduct::class, 'product_id'); } public function canRevoke() { return ($this->type == static::TYPE_OFFLINE_OUT) && ($this->revoke_id == 0); } public function getQtyFormatAttribute() { $symbok = in_array($this->type, [ DealerUserProductLog::TYPE_ORDER_IN, DealerUserProductLog::TYPE_ADMIN_IN, DealerUserProductLog::TYPE_REVOKE_IN, DealerUserProductLog::TYPE_TRANSFER_IN, DealerUserProductLog::TYPE_DEPOSIT_TRANSFER_REVOKE, DealerUserProductLog::TYPE_ORDER_OUT_REVOKE, ]) ? '+' : '-'; return $symbok . $this->attributes['qty']; } }