weixin_39876856 2020-11-30 11:42
浏览 0

Version 8.0.3 breaks support for non-integer keys

| Q | A | ----------------- | --- | Bug? | yes | New Feature? | no | Framework | Laravel | Framework version | 5.7.25 | Package version | >=8.0.3 | PHP version | 7.2.x

Actual Behaviour

This PR here https://github.com/owen-it/laravel-auditing/pull/448/files

For this issue (from what I understand): https://github.com/owen-it/laravel-auditing/issues/432

Will actually break any project using non-numeric (or non-integer) primary key IDs. In our case, we are using UUIDs (which I would think is quite common these days).

The end result is that any update to the underlying model will wipe all audits and it will no longer have any related audits.

Expected Behaviour

As laravel supports non-integer keys, so should this package. Update shouldn't break existing functionality.

Steps to Reproduce

Create a new model in Laravel with the following properties and as a string in the database (for field type)

php
    /**
     *  bool Set to false for UUID keys
     */
    public $incrementing = false;

    /**
     *  string Set to string for UUID keys
     */
    protected $keyType = 'string';

Deploy the auditable trait on it, and see what happens on model update.

Possible Solutions

The auditable_id cast to integer needs to be removed

该提问来源于开源项目:owen-it/laravel-auditing

  • 写回答

0条回答 默认 最新

    报告相同问题?